Skip to content

Commit

Permalink
Merge pull request #102683 from cdepillabout/shellFor-add-benchmark
Browse files Browse the repository at this point in the history
haskellPackages.shellFor: add a doBenchmark argument for enabling benchmark deps
  • Loading branch information
cdepillabout committed Nov 5, 2020
2 parents f1aaf9e + aedb5d2 commit 1d8685a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkgs/development/haskell-modules/make-package-set.nix
Expand Up @@ -293,6 +293,10 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
, # Whether or not to generate a Hoogle database for all the
# dependencies.
withHoogle ? false
, # Whether or not to include benchmark dependencies of your local
# packages. You should set this to true if you have benchmarks defined
# in your local packages that you want to be able to run with cabal benchmark
doBenchmark ? false
, ...
} @ args:
let
Expand Down Expand Up @@ -397,7 +401,11 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
version = "0";
license = null;
}
// packageInputs;
// packageInputs
// pkgs.lib.optionalAttrs doBenchmark {
# `doBenchmark` needs to explicitly be set here because haskellPackages.mkDerivation defaults it to `false`. If the user wants benchmark dependencies included in their development shell, it has to be explicitly enabled here.
doBenchmark = true;
};

# This is a pseudo Haskell package derivation that contains all the
# dependencies for the packages in `selected`.
Expand All @@ -419,7 +427,7 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
# pkgWithCombinedDepsDevDrv :: Derivation
pkgWithCombinedDepsDevDrv = pkgWithCombinedDeps.envFunc { inherit withHoogle; };

mkDerivationArgs = builtins.removeAttrs args [ "packages" "withHoogle" ];
mkDerivationArgs = builtins.removeAttrs args [ "packages" "withHoogle" "doBenchmark" ];

in pkgWithCombinedDepsDevDrv.overrideAttrs (old: mkDerivationArgs // {
nativeBuildInputs = old.nativeBuildInputs ++ mkDerivationArgs.nativeBuildInputs or [];
Expand Down

0 comments on commit 1d8685a

Please sign in to comment.