haskellPackages.*.env: Use shellFor

This commit is contained in:
Silvan Mosberger 2018-09-17 23:20:29 +02:00 committed by Will Fancher
parent 08814b72cf
commit 2bafa93b75
2 changed files with 7 additions and 28 deletions

View File

@ -1,5 +1,5 @@
{ stdenv, buildPackages, buildHaskellPackages, ghc
, jailbreak-cabal, hscolour, cpphs, nodejs
, jailbreak-cabal, hscolour, cpphs, nodejs, shellFor
}:
let
@ -195,18 +195,10 @@ let
isHaskellPartition =
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";
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
ghcCommandCaps= toUpper ghcCommand';
nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
@ -216,8 +208,7 @@ let
continue
fi
'';
in
in stdenv.lib.fix (drv:
assert allPkgconfigDepends != [] -> pkgconfig != null;
@ -447,23 +438,10 @@ stdenv.mkDerivation ({
# TODO: fetch the self from the fixpoint instead
haddockDir = self: if doHaddock then "${docdir self.doc}/html" else null;
env = stdenv.mkDerivation {
name = "interactive-${pname}-${version}-environment";
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}
'';
env = shellFor {
packages = p: [ drv ];
};
};
meta = { inherit homepage license platforms; }
@ -497,3 +475,4 @@ stdenv.mkDerivation ({
// optionalAttrs (hardeningDisable != []) { inherit hardeningDisable; }
// optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }
)
)

View File

@ -43,7 +43,7 @@ let
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
inherit stdenv;
nodejs = buildPackages.nodejs-slim;
inherit (self) buildHaskellPackages ghc;
inherit (self) buildHaskellPackages ghc shellFor;
inherit (self.buildHaskellPackages) jailbreak-cabal;
hscolour = overrideCabal self.buildHaskellPackages.hscolour (drv: {
isLibrary = false;