Skip to content

Commit

Permalink
haskellPackages.*.env: Use shellFor
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil authored and peti committed Oct 3, 2018
1 parent 56da05d commit 5067773
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
33 changes: 6 additions & 27 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ stdenv, buildPackages, buildHaskellPackages, ghc
, jailbreak-cabal, hscolour, cpphs, nodejs
, jailbreak-cabal, hscolour, cpphs, nodejs, shellFor
}:

let
Expand Down Expand Up @@ -196,18 +196,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";

Expand All @@ -217,8 +209,7 @@ let
continue
fi
'';

in
in stdenv.lib.fix (drv:

assert allPkgconfigDepends != [] -> pkgconfig != null;

Expand Down Expand Up @@ -448,23 +439,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; }
Expand Down Expand Up @@ -498,3 +476,4 @@ stdenv.mkDerivation ({
// optionalAttrs (hardeningDisable != []) { inherit hardeningDisable; }
// optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }
)
)
2 changes: 1 addition & 1 deletion pkgs/development/haskell-modules/make-package-set.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5067773

Please sign in to comment.