summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/lib.nix
diff options
context:
space:
mode:
authorIsaac Shapira <fresheyeball@protonmail.com>2021-04-23 13:55:38 -0600
committer(cdep)illabout <cdep.illabout@gmail.com>2021-05-02 13:35:07 +0900
commitd725ac794286e3464d80f5bce69da98ff4b2ebbf (patch)
tree5e617d1c5230b3406acd98e5102046d3f60bd40e /pkgs/development/haskell-modules/lib.nix
parent111151c4bc57287ef449eb4f06083d6aedccaa19 (diff)
downloadnixpkgs-d725ac794286e3464d80f5bce69da98ff4b2ebbf.tar
nixpkgs-d725ac794286e3464d80f5bce69da98ff4b2ebbf.tar.gz
nixpkgs-d725ac794286e3464d80f5bce69da98ff4b2ebbf.tar.bz2
nixpkgs-d725ac794286e3464d80f5bce69da98ff4b2ebbf.tar.lz
nixpkgs-d725ac794286e3464d80f5bce69da98ff4b2ebbf.tar.xz
nixpkgs-d725ac794286e3464d80f5bce69da98ff4b2ebbf.tar.zst
nixpkgs-d725ac794286e3464d80f5bce69da98ff4b2ebbf.zip
Add haskell.lib.setBuiltTarget, and support non library compiling of a single target
Diffstat (limited to 'pkgs/development/haskell-modules/lib.nix')
-rw-r--r--pkgs/development/haskell-modules/lib.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix
index 1537cd6466c..682953c3ce9 100644
--- a/pkgs/development/haskell-modules/lib.nix
+++ b/pkgs/development/haskell-modules/lib.nix
@@ -196,6 +196,16 @@ rec {
   appendPatch = drv: x: appendPatches drv [x];
   appendPatches = drv: xs: overrideCabal drv (drv: { patches = (drv.patches or []) ++ xs; });
 
+  /* Set a specific build target instead of compiling all targets in the package.
+   * For example, imagine we have a .cabal file with a library, and 2 executables "dev" and "server".
+   * We can build only "server" and not wait on the compilation of "dev" by useing setBuildTarget as follows:
+   *
+   *   setBuildTarget (callCabal2nix "thePackageName" thePackageSrc {}) "server"
+   *
+   */
+  setBuildTargets = drv: xs: overrideCabal drv (drv: { buildTarget = lib.concatStringsSep " " xs; });
+  setBuildTarget = drv: x: setBuildTargets drv [x];
+
   doHyperlinkSource = drv: overrideCabal drv (drv: { hyperlinkSource = true; });
   dontHyperlinkSource = drv: overrideCabal drv (drv: { hyperlinkSource = false; });