Merge pull request #34405 from pjan/developPackage-modifier

Adds modifier option to developPackage
This commit is contained in:
Peter Simons 2018-01-30 19:26:07 +01:00 committed by GitHub
commit ade2840f20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,18 +161,19 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
# : { root : Path
# , source-overrides : Defaulted (Either Path VersionNumber)
# , overrides : Defaulted (HaskellPackageOverrideSet)
# , modifier : Defaulted
# } -> NixShellAwareDerivation
# Given a path to a haskell package directory whose cabal file is
# named the same as the directory name, an optional set of
# source overrides as appropriate for the 'packageSourceOverrides'
# function, and an optional set of arbitrary overrides,
# return a derivation appropriate for nix-build or nix-shell
# to build that package.
developPackage = { root, source-overrides ? {}, overrides ? self: super: {} }:
# function, an optional set of arbitrary overrides, and an optional
# haskell package modifier, return a derivation appropriate
# for nix-build or nix-shell to build that package.
developPackage = { root, source-overrides ? {}, overrides ? self: super: {}, modifier ? drv: drv }:
let name = builtins.baseNameOf root;
drv =
(extensible-self.extend (pkgs.lib.composeExtensions (self.packageSourceOverrides source-overrides) overrides)).callCabal2nix name root {};
in if pkgs.lib.inNixShell then drv.env else drv;
in if pkgs.lib.inNixShell then (modifier drv).env else modifier drv;
ghcWithPackages = selectFrom: withPackages (selectFrom self);