summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/with-packages-wrapper.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2015-03-29 05:24:35 +0300
committerNikolay Amiantov <ab@fmap.me>2015-03-29 13:15:39 +0300
commit8943ffcd2b871f43112737d2b1342d289776c2ed (patch)
tree384cb1a562f2d6a91ef16f24bc0b1c4e76dabbf3 /pkgs/development/haskell-modules/with-packages-wrapper.nix
parentda26c13df525772d6d84fc90ae6e95870d6a1174 (diff)
downloadnixlib-8943ffcd2b871f43112737d2b1342d289776c2ed.tar
nixlib-8943ffcd2b871f43112737d2b1342d289776c2ed.tar.gz
nixlib-8943ffcd2b871f43112737d2b1342d289776c2ed.tar.bz2
nixlib-8943ffcd2b871f43112737d2b1342d289776c2ed.tar.lz
nixlib-8943ffcd2b871f43112737d2b1342d289776c2ed.tar.xz
nixlib-8943ffcd2b871f43112737d2b1342d289776c2ed.tar.zst
nixlib-8943ffcd2b871f43112737d2b1342d289776c2ed.zip
ghcWithPackages: restore old style (without 'with')
Diffstat (limited to 'pkgs/development/haskell-modules/with-packages-wrapper.nix')
-rw-r--r--pkgs/development/haskell-modules/with-packages-wrapper.nix22
1 files changed, 10 insertions, 12 deletions
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix
index be3e2e22a131..22932eea665d 100644
--- a/pkgs/development/haskell-modules/with-packages-wrapper.nix
+++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix
@@ -1,11 +1,9 @@
-{ stdenv, ghc, llvmPackages, packages, buildEnv
+{ stdenv, lib, ghc, llvmPackages, packages, buildEnv
 , makeWrapper
 , ignoreCollisions ? false, withLLVM ? false }:
 
-with stdenv.lib;
-
 # This wrapper works only with GHC 6.12 or later.
-assert versionOlder "6.12" ghc.version;
+assert lib.versionOlder "6.12" ghc.version;
 
 # It's probably a good idea to include the library "ghc-paths" in the
 # compiler environment, because we have a specially patched version of
@@ -30,19 +28,19 @@ assert versionOlder "6.12" ghc.version;
 
 let
   isGhcjs       = ghc.isGhcjs or false;
-  ghc761OrLater = isGhcjs || versionOlder "7.6.1" ghc.version;
+  ghc761OrLater = isGhcjs || lib.versionOlder "7.6.1" ghc.version;
   packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
   ghcCommand    = if isGhcjs then "ghcjs" else "ghc";
   libDir        = "$out/lib/${ghcCommand}-${ghc.version}";
   docDir        = "$out/share/doc/ghc/html";
   packageCfgDir = "${libDir}/package.conf.d";
-  paths         = filter (x: x ? isHaskellLibrary) (closePropagation packages);
-  hasLibraries  = any (x: x.isHaskellLibrary) paths;
+  paths         = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);
+  hasLibraries  = lib.any (x: x.isHaskellLibrary) paths;
   # CLang is needed on Darwin for -fllvm to work:
   # https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/code-generators.html
-  llvm          = makeSearchPath "bin"
+  llvm          = lib.makeSearchPath "bin"
                   ([ llvmPackages.llvm ]
-                   ++ optional stdenv.isDarwin llvmPackages.clang);
+                   ++ lib.optional stdenv.isDarwin llvmPackages.clang);
 in
 if paths == [] && !withLLVM then ghc else
 buildEnv {
@@ -52,7 +50,7 @@ buildEnv {
   postBuild = ''
     . ${makeWrapper}/nix-support/setup-hook
 
-    ${optionalString isGhcjs ''
+    ${lib.optionalString isGhcjs ''
     cp -r "${ghc}/${ghc.libDir}/"* ${libDir}/
     ''}
 
@@ -71,7 +69,7 @@ buildEnv {
         --set "NIX_GHCPKG"     "$out/bin/${ghcCommand}-pkg" \
         --set "NIX_GHC_DOCDIR" "${docDir}"                  \
         --set "NIX_GHC_LIBDIR" "${libDir}"                  \
-        ${optionalString withLLVM ''--prefix "PATH" ":" "${llvm}"''}
+        ${lib.optionalString withLLVM ''--prefix "PATH" ":" "${llvm}"''}
     done
 
     for prg in runghc runhaskell; do
@@ -89,7 +87,7 @@ buildEnv {
       makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
     done
 
-    ${optionalString hasLibraries "$out/bin/${ghcCommand}-pkg recache"}
+    ${lib.optionalString hasLibraries "$out/bin/${ghcCommand}-pkg recache"}
     $out/bin/${ghcCommand}-pkg check
   '';
 } // {