From 5067773e39a4ac0a001612da15bf653a84d6f50d Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Mon, 17 Sep 2018 23:20:29 +0200 Subject: haskellPackages.*.env: Use shellFor --- .../haskell-modules/generic-builder.nix | 33 ++++------------------ .../haskell-modules/make-package-set.nix | 2 +- 2 files changed, 7 insertions(+), 28 deletions(-) (limited to 'pkgs') diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 8dea5d0493b3..a3426f4e249d 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -1,5 +1,5 @@ { stdenv, buildPackages, buildHaskellPackages, ghc -, jailbreak-cabal, hscolour, cpphs, nodejs +, jailbreak-cabal, hscolour, cpphs, nodejs, shellFor }: let @@ -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"; @@ -217,8 +209,7 @@ let continue fi ''; - -in +in stdenv.lib.fix (drv: assert allPkgconfigDepends != [] -> pkgconfig != null; @@ -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; } @@ -498,3 +476,4 @@ stdenv.mkDerivation ({ // optionalAttrs (hardeningDisable != []) { inherit hardeningDisable; } // optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; } ) +) diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index bc794cf641d6..ef2c33c10915 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -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; -- cgit 1.4.1