about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/make-package-set.nix
diff options
context:
space:
mode:
authorJoe Hermaszewski <git@monoid.al>2020-11-13 13:37:40 +0800
committerPeter Simons <simons@cryp.to>2020-11-13 21:37:57 +0100
commit49e9758ef335d7266d755556d12e55c6df4feb31 (patch)
treea459981600c52c77143a15dba7e67981cd93005e /pkgs/development/haskell-modules/make-package-set.nix
parenta32c231007afc4a934bcca47a9ac7edb44a5f784 (diff)
haskell: Add cabal2nixOptions to developPackage
Also neaten documentation slightly
Diffstat (limited to 'pkgs/development/haskell-modules/make-package-set.nix')
-rw-r--r--pkgs/development/haskell-modules/make-package-set.nix13
1 files changed, 11 insertions, 2 deletions
diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix
index 2ce8ad989f8dd..4ae3f0b2427f4 100644
--- a/pkgs/development/haskell-modules/make-package-set.nix
+++ b/pkgs/development/haskell-modules/make-package-set.nix
@@ -222,19 +222,27 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
     #   , 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
@@ -242,13 +250,14 @@ in package-set { inherit pkgs stdenv callPackage; } self // {
       , overrides ? self: super: {}
       , modifier ? drv: drv
       , returnShellEnv ? pkgs.lib.inNixShell
-      , withHoogle ? returnShellEnv }:
+      , withHoogle ? returnShellEnv
+      , cabal2nixOptions ? "" }:
       let drv =
         (extensible-self.extend
            (pkgs.lib.composeExtensions
               (self.packageSourceOverrides source-overrides)
               overrides))
-        .callCabal2nix name root {};
+        .callCabal2nixWithOptions name root cabal2nixOptions {};
       in if returnShellEnv
            then (modifier drv).envFunc {inherit withHoogle;}
            else modifier drv;