haskell: add withHoogle option to developPackage

This commit is contained in:
Joe Hermaszewski 2020-11-11 11:02:05 +08:00 committed by Peter Simons
parent 07e697d22d
commit a32c231007

View File

@ -221,6 +221,7 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
# , overrides : Defaulted (HaskellPackageOverrideSet) # , overrides : Defaulted (HaskellPackageOverrideSet)
# , modifier : Defaulted # , modifier : Defaulted
# , returnShellEnv : Defaulted # , returnShellEnv : Defaulted
# , withHoogle : Defaulted
# } -> NixShellAwareDerivation # } -> NixShellAwareDerivation
# Given a path to a haskell package directory, an optional package name # Given a path to a haskell package directory, an optional package name
# which defaults to the base name of the path, an optional set of source # which defaults to the base name of the path, an optional set of source
@ -231,20 +232,26 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
# If 'returnShellEnv' is true this returns a derivation which will give you # If 'returnShellEnv' is true this returns a derivation which will give you
# an environment suitable for developing the listed packages with an # an environment suitable for developing the listed packages with an
# incremental tool like cabal-install. # incremental tool like cabal-install.
# If 'withHoogle' is true (the default if a shell environment is requested)
# then 'ghcWithHoogle' is used to generate the derivation (instead of
# 'ghcWithPackages'), see the documentation there for more information.
developPackage = developPackage =
{ root { root
, name ? builtins.baseNameOf root , name ? builtins.baseNameOf root
, source-overrides ? {} , source-overrides ? {}
, overrides ? self: super: {} , overrides ? self: super: {}
, modifier ? drv: drv , modifier ? drv: drv
, returnShellEnv ? pkgs.lib.inNixShell }: , returnShellEnv ? pkgs.lib.inNixShell
, withHoogle ? returnShellEnv }:
let drv = let drv =
(extensible-self.extend (extensible-self.extend
(pkgs.lib.composeExtensions (pkgs.lib.composeExtensions
(self.packageSourceOverrides source-overrides) (self.packageSourceOverrides source-overrides)
overrides)) overrides))
.callCabal2nix name root {}; .callCabal2nix name root {};
in if returnShellEnv then (modifier drv).env else modifier drv; in if returnShellEnv
then (modifier drv).envFunc {inherit withHoogle;}
else modifier drv;
ghcWithPackages = selectFrom: withPackages (selectFrom self); ghcWithPackages = selectFrom: withPackages (selectFrom self);