haskellPackages.*.env: Use shellFor
This commit is contained in:
parent
56da05d459
commit
5067773e39
@ -1,5 +1,5 @@
|
|||||||
{ stdenv, buildPackages, buildHaskellPackages, ghc
|
{ stdenv, buildPackages, buildHaskellPackages, ghc
|
||||||
, jailbreak-cabal, hscolour, cpphs, nodejs
|
, jailbreak-cabal, hscolour, cpphs, nodejs, shellFor
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -196,18 +196,10 @@ let
|
|||||||
isHaskellPartition =
|
isHaskellPartition =
|
||||||
stdenv.lib.partition isHaskellPkg allBuildInputs;
|
stdenv.lib.partition isHaskellPkg allBuildInputs;
|
||||||
|
|
||||||
haskellBuildInputs = stdenv.lib.filter isHaskellPkg allBuildInputs;
|
|
||||||
systemBuildInputs = stdenv.lib.filter isSystemPkg allBuildInputs;
|
|
||||||
|
|
||||||
# When not cross compiling, also include Setup.hs dependencies.
|
|
||||||
ghcEnv = ghc.withPackages (p:
|
|
||||||
haskellBuildInputs ++ stdenv.lib.optional (!isCross) setupHaskellDepends);
|
|
||||||
|
|
||||||
setupCommand = "./Setup";
|
setupCommand = "./Setup";
|
||||||
|
|
||||||
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
||||||
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
||||||
ghcCommandCaps= toUpper ghcCommand';
|
|
||||||
|
|
||||||
nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
|
nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
|
||||||
|
|
||||||
@ -217,8 +209,7 @@ let
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
in stdenv.lib.fix (drv:
|
||||||
in
|
|
||||||
|
|
||||||
assert allPkgconfigDepends != [] -> pkgconfig != null;
|
assert allPkgconfigDepends != [] -> pkgconfig != null;
|
||||||
|
|
||||||
@ -448,23 +439,10 @@ stdenv.mkDerivation ({
|
|||||||
# TODO: fetch the self from the fixpoint instead
|
# TODO: fetch the self from the fixpoint instead
|
||||||
haddockDir = self: if doHaddock then "${docdir self.doc}/html" else null;
|
haddockDir = self: if doHaddock then "${docdir self.doc}/html" else null;
|
||||||
|
|
||||||
env = stdenv.mkDerivation {
|
env = shellFor {
|
||||||
name = "interactive-${pname}-${version}-environment";
|
packages = p: [ drv ];
|
||||||
buildInputs = systemBuildInputs;
|
|
||||||
nativeBuildInputs = [ ghcEnv ] ++ nativeBuildInputs;
|
|
||||||
LANG = "en_US.UTF-8";
|
|
||||||
LOCALE_ARCHIVE = optionalString (stdenv.hostPlatform.libc == "glibc") "${glibcLocales}/lib/locale/locale-archive";
|
|
||||||
shellHook = ''
|
|
||||||
export NIX_${ghcCommandCaps}="${ghcEnv}/bin/${ghcCommand}"
|
|
||||||
export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg"
|
|
||||||
# TODO: is this still valid?
|
|
||||||
export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html"
|
|
||||||
${if isHaLVM
|
|
||||||
then ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/HaLVM-${ghc.version}"''
|
|
||||||
else ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"''}
|
|
||||||
${shellHook}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = { inherit homepage license platforms; }
|
meta = { inherit homepage license platforms; }
|
||||||
@ -498,3 +476,4 @@ stdenv.mkDerivation ({
|
|||||||
// optionalAttrs (hardeningDisable != []) { inherit hardeningDisable; }
|
// optionalAttrs (hardeningDisable != []) { inherit hardeningDisable; }
|
||||||
// optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }
|
// optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
@ -43,7 +43,7 @@ let
|
|||||||
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
|
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
|
||||||
inherit stdenv;
|
inherit stdenv;
|
||||||
nodejs = buildPackages.nodejs-slim;
|
nodejs = buildPackages.nodejs-slim;
|
||||||
inherit (self) buildHaskellPackages ghc;
|
inherit (self) buildHaskellPackages ghc shellFor;
|
||||||
inherit (self.buildHaskellPackages) jailbreak-cabal;
|
inherit (self.buildHaskellPackages) jailbreak-cabal;
|
||||||
hscolour = overrideCabal self.buildHaskellPackages.hscolour (drv: {
|
hscolour = overrideCabal self.buildHaskellPackages.hscolour (drv: {
|
||||||
isLibrary = false;
|
isLibrary = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user