summary refs log tree commit diff
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-01-10 12:08:36 -0500
committerShea Levy <shea@shealevy.com>2018-01-10 12:08:36 -0500
commit3a763b91963ef747b188e7062d7a02119d2ef6d3 (patch)
tree08d58d81512211509120756c217db10d2de5046c
parent65b075991f2af891099a82ff5b164ce9884036b9 (diff)
downloadnixlib-3a763b91963ef747b188e7062d7a02119d2ef6d3.tar
nixlib-3a763b91963ef747b188e7062d7a02119d2ef6d3.tar.gz
nixlib-3a763b91963ef747b188e7062d7a02119d2ef6d3.tar.bz2
nixlib-3a763b91963ef747b188e7062d7a02119d2ef6d3.tar.lz
nixlib-3a763b91963ef747b188e7062d7a02119d2ef6d3.tar.xz
nixlib-3a763b91963ef747b188e7062d7a02119d2ef6d3.tar.zst
nixlib-3a763b91963ef747b188e7062d7a02119d2ef6d3.zip
haskellLib: Add shellAware function
-rw-r--r--pkgs/development/haskell-modules/lib.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix
index 6a724130d254..da4e9c6777bd 100644
--- a/pkgs/development/haskell-modules/lib.nix
+++ b/pkgs/development/haskell-modules/lib.nix
@@ -154,6 +154,10 @@ rec {
     (p.override { mkDerivation = extractBuildInputs p.compiler;
                 }).haskellBuildInputs;
 
+  # Under normal evaluation, simply return the original package. Under
+  # nix-shell evaluation, return a nix-shell optimized environment.
+  shellAware = p: if lib.inNixShell then p.env else p;
+
   ghcInfo = ghc:
     rec { isCross = (ghc.cross or null) != null;
           isGhcjs = ghc.isGhcjs or false;