diff options
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r-- | pkgs/development/haskell-modules/generic-builder.nix | 4 | ||||
-rw-r--r-- | pkgs/development/haskell-modules/with-packages-wrapper.nix | 21 |
2 files changed, 14 insertions, 11 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 42ea03693ecd..e47375e71c73 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -193,11 +193,13 @@ stdenv.mkDerivation ({ ${jailbreak-cabal}/bin/jailbreak-cabal ${pname}.cabal '' + postPatch; + # for ghcjs, we want to put ghcEnv on PATH so compiler plugins will be available. + # TODO(cstrahan): would the same be of benefit to native ghc? setupCompilerEnvironmentPhase = '' runHook preSetupCompilerEnvironment echo "Build with ${ghc}." - export PATH="${ghc}/bin:$PATH" + export PATH="${if ghc.isGhcjs or false then ghcEnv else ghc}/bin:$PATH" ${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"} packageConfDir="$TMPDIR/package.conf.d" diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix index c49b81762e71..e04cbe08c2c7 100644 --- a/pkgs/development/haskell-modules/with-packages-wrapper.nix +++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix @@ -1,9 +1,12 @@ -{ stdenv, lib, ghc, llvmPackages, packages, buildEnv, makeWrapper +{ stdenv, lib, ghc, llvmPackages, packages, symlinkJoin, makeWrapper , ignoreCollisions ? false, withLLVM ? false , postBuild ? "" , haskellPackages +, ghcLibdir ? null # only used by ghcjs, when resolving plugins }: +assert ghcLibdir != null -> (ghc.isGhcjs or false); + # This wrapper works only with GHC 6.12 or later. assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs; @@ -48,7 +51,7 @@ let ++ lib.optional stdenv.isDarwin llvmPackages.clang); in if paths == [] && !withLLVM then ghc else -buildEnv { +symlinkJoin { # this makes computing paths from the name attribute impossible; # if such a feature is needed, the real compiler name should be saved # as a dedicated drv attribute, like `compiler-name` @@ -59,14 +62,6 @@ buildEnv { postBuild = '' . ${makeWrapper}/nix-support/setup-hook - # Work around buildEnv sometimes deciding to make bin a symlink - if test -L "$out/bin"; then - binTarget="$(readlink -f "$out/bin")" - rm "$out/bin" - cp -r "$binTarget" "$out/bin" - chmod u+w "$out/bin" - fi - # wrap compiler executables with correct env variables for prg in ${ghcCommand} ${ghcCommand}i ${ghcCommand}-${ghc.version} ${ghcCommand}i-${ghc.version}; do @@ -102,6 +97,12 @@ buildEnv { done ${lib.optionalString hasLibraries "$out/bin/${ghcCommand}-pkg recache"} + ${# ghcjs will read the ghc_libdir file when resolving plugins. + lib.optionalString (isGhcjs && ghcLibdir != null) '' + mkdir -p "${libDir}" + rm -f "${libDir}/ghc_libdir" + printf '%s' '${ghcLibdir}' > "${libDir}/ghc_libdir" + ''} $out/bin/${ghcCommand}-pkg check '' + postBuild; passthru = { |