haskell: Add cabal2nixOptions to developPackage
Also neaten documentation slightly
This commit is contained in:
parent
a32c231007
commit
49e9758ef3
|
@ -222,19 +222,27 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
|
||||||
# , modifier : Defaulted
|
# , modifier : Defaulted
|
||||||
# , returnShellEnv : Defaulted
|
# , returnShellEnv : Defaulted
|
||||||
# , withHoogle : Defaulted
|
# , withHoogle : Defaulted
|
||||||
|
# , cabal2nixOptions : 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
|
||||||
# overrides as appropriate for the 'packageSourceOverrides' function, an
|
# overrides as appropriate for the 'packageSourceOverrides' function, an
|
||||||
# optional set of arbitrary overrides, and an optional haskell package
|
# optional set of arbitrary overrides, and an optional haskell package
|
||||||
# modifier, return a derivation appropriate for nix-build or nix-shell to
|
# modifier, return a derivation appropriate for nix-build or nix-shell to
|
||||||
# build that package.
|
# build that package.
|
||||||
|
#
|
||||||
# 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)
|
# If 'withHoogle' is true (the default if a shell environment is requested)
|
||||||
# then 'ghcWithHoogle' is used to generate the derivation (instead of
|
# then 'ghcWithHoogle' is used to generate the derivation (instead of
|
||||||
# 'ghcWithPackages'), see the documentation there for more information.
|
# '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 =
|
developPackage =
|
||||||
{ root
|
{ root
|
||||||
, name ? builtins.baseNameOf root
|
, name ? builtins.baseNameOf root
|
||||||
|
@ -242,13 +250,14 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
|
||||||
, overrides ? self: super: {}
|
, overrides ? self: super: {}
|
||||||
, modifier ? drv: drv
|
, modifier ? drv: drv
|
||||||
, returnShellEnv ? pkgs.lib.inNixShell
|
, returnShellEnv ? pkgs.lib.inNixShell
|
||||||
, withHoogle ? returnShellEnv }:
|
, withHoogle ? returnShellEnv
|
||||||
|
, cabal2nixOptions ? "" }:
|
||||||
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 {};
|
.callCabal2nixWithOptions name root cabal2nixOptions {};
|
||||||
in if returnShellEnv
|
in if returnShellEnv
|
||||||
then (modifier drv).envFunc {inherit withHoogle;}
|
then (modifier drv).envFunc {inherit withHoogle;}
|
||||||
else modifier drv;
|
else modifier drv;
|
||||||
|
|
Loading…
Reference in a new issue