aboutsummaryrefslogtreecommitdiff
path: root/pkgs/development/haskell-modules/make-package-set.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/haskell-modules/make-package-set.nix')
-rw-r--r--pkgs/development/haskell-modules/make-package-set.nix32
1 files changed, 29 insertions, 3 deletions
diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix
index ac65fad35270..4ae3f0b2427f 100644
--- a/pkgs/development/haskell-modules/make-package-set.nix
+++ b/pkgs/development/haskell-modules/make-package-set.nix
@@ -221,30 +221,56 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
# , overrides : Defaulted (HaskellPackageOverrideSet)
# , modifier : Defaulted
# , returnShellEnv : Defaulted
+ # , withHoogle : Defaulted
+ # , cabal2nixOptions : Defaulted
# } -> NixShellAwareDerivation
+ #
# 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
# overrides as appropriate for the 'packageSourceOverrides' 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.
+ #
+ # If 'returnShellEnv' is true this returns a derivation which will give you
+ # an environment suitable for developing the listed packages with an
+ # 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.
+ #
+ # 'cabal2nixOptions' can contain extra command line arguments to pass to
+ # 'cabal2nix' when generating the package derivation, for example setting
+ # a cabal flag with '--flag=myflag'.
developPackage =
{ root
, name ? builtins.baseNameOf root
, source-overrides ? {}
, overrides ? self: super: {}
, modifier ? drv: drv
- , returnShellEnv ? pkgs.lib.inNixShell }:
+ , returnShellEnv ? pkgs.lib.inNixShell
+ , withHoogle ? returnShellEnv
+ , cabal2nixOptions ? "" }:
let drv =
(extensible-self.extend
(pkgs.lib.composeExtensions
(self.packageSourceOverrides source-overrides)
overrides))
- .callCabal2nix name root {};
- in if returnShellEnv then (modifier drv).env else modifier drv;
+ .callCabal2nixWithOptions name root cabal2nixOptions {};
+ in if returnShellEnv
+ then (modifier drv).envFunc {inherit withHoogle;}
+ else modifier drv;
ghcWithPackages = selectFrom: withPackages (selectFrom self);
+ # Put 'hoogle' into the derivation's PATH with a database containing all
+ # the package's dependencies; run 'hoogle server --local' in a shell to
+ # host a search engine for the dependencies.
+ #
+ # To reload the Hoogle server automatically on .cabal file changes try
+ # this:
+ # echo *.cabal | entr -r -- nix-shell --run 'hoogle server --local'
ghcWithHoogle = selectFrom:
let
packages = selectFrom self;