From 7f5fba75e2ab640c1d7c65294447514ec443598f Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Fri, 16 Mar 2018 21:14:51 +0100 Subject: [PATCH] haskell-generic-builder: compile profiling library variants by default Unless specified otherwise, the default package set compiles library variants for profiling with profiling-detail "all-functions". Executables, however, are not built with profiling enabled. This change increases the closure size for many Haskell programs, but the practical advantage of having stack traces and performance measurements easily available during development seems to outweigh that cost. Closes https://github.com/NixOS/nixpkgs/issues/22340. --- pkgs/development/haskell-modules/generic-builder.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index a29056d965a..07ef985ca33 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -24,8 +24,9 @@ in , doBenchmark ? false , doHoogle ? true , editedCabalFile ? null -, enableLibraryProfiling ? false +, enableLibraryProfiling ? true , enableExecutableProfiling ? false +, profilingDetail ? "all-functions" # TODO enable shared libs for cross-compiling , enableSharedExecutables ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version) , enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version) @@ -135,6 +136,7 @@ let (optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp") (enableFeature (enableDeadCodeElimination && !hostPlatform.isArm && !hostPlatform.isAarch64 && (versionAtLeast "8.0.1" ghc.version)) "split-objs") (enableFeature enableLibraryProfiling "library-profiling") + (optionalString (enableExecutableProfiling || enableLibraryProfiling) "--profiling-detail=${profilingDetail}") (enableFeature enableExecutableProfiling (if versionOlder ghc.version "8" then "executable-profiling" else "profiling")) (enableFeature enableSharedLibraries "shared") (optionalString (versionAtLeast ghc.version "7.10") (enableFeature doCoverage "coverage"))