From ef3bc04a7c4802a39ff7c52d9d4f20991ed251b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 20 Nov 2018 07:45:12 +0000 Subject: [PATCH] Be able to pass doOptimize/doProfiling flags to nix build --- default.nix | 8 +++++++- hnix.cabal | 4 ++-- package.yaml | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index 3f85437..336da2c 100644 --- a/default.nix +++ b/default.nix @@ -2,6 +2,10 @@ , doBenchmark ? false , doTracing ? false +# enables GHC optimizations for production use +, doOptimize ? false +# enables profiling support in GHC +, doProfiling ? false , doStrict ? false , rev ? "b37872d4268164614e3ecef6e1f730d48cf5a90f" @@ -70,7 +74,8 @@ drv = haskellPackages.developPackage { pkgs.haskell.packages.${compiler}.cabal-install ]; - enableLibraryProfiling = false; + enableLibraryProfiling = doProfiling; + enableExecutableProfiling = doProfiling; testHaskellDepends = attrs.testHaskellDepends ++ [ pkgs.nix @@ -88,6 +93,7 @@ drv = haskellPackages.developPackage { configureFlags = pkgs.stdenv.lib.optional doTracing "--flags=tracing" + ++ pkgs.stdenv.lib.optional doOptimize "--flags=optimize" ++ pkgs.stdenv.lib.optional doStrict "--ghc-options=-Werror"; passthru = { diff --git a/hnix.cabal b/hnix.cabal index 7ebf391..b72d9ca 100644 --- a/hnix.cabal +++ b/hnix.cabal @@ -2,7 +2,7 @@ -- -- see: https://github.com/sol/hpack -- --- hash: 07b6631da5bfe4929607211146ef8fdde38ea28d4aece34188af8e33d0287e5e +-- hash: bd9c8bad70af6e6bdc23b53988448061d7ab6aaee6054beb9d0f696e717f8a3c name: hnix version: 0.5.2 @@ -573,7 +573,7 @@ executable hnix Paths_hnix hs-source-dirs: main - ghc-options: -Wall + ghc-options: -Wall -rtsopts build-depends: aeson , base >=4.9 && <5 diff --git a/package.yaml b/package.yaml index f701015..9b4d066 100644 --- a/package.yaml +++ b/package.yaml @@ -155,6 +155,7 @@ executables: hnix: source-dirs: main main: Main.hs + ghc-options: -rtsopts dependencies: - hnix - aeson