diff options
Diffstat (limited to 'pkgs/development/compilers/ghc/wrapper.nix')
-rw-r--r-- | pkgs/development/compilers/ghc/wrapper.nix | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/pkgs/development/compilers/ghc/wrapper.nix b/pkgs/development/compilers/ghc/wrapper.nix index 932cf6343018..5cacfdf8f894 100644 --- a/pkgs/development/compilers/ghc/wrapper.nix +++ b/pkgs/development/compilers/ghc/wrapper.nix @@ -1,14 +1,27 @@ -{stdenv, ghc}: +{stdenv, ghc, makeWrapper}: stdenv.mkDerivation { - name = "ghc-wrapper-${ghc.version}"; + name = "ghc-${ghc.version}-wrapper"; + buildInputs = [makeWrapper]; propagatedBuildInputs = [ghc]; unpackPhase = "true"; - installPhase = "true"; + installPhase = '' + ensureDir $out/bin + cp $GHCGetPackages $out/bin/ghc-get-packages.sh + chmod 755 $out/bin/ghc-get-packages.sh + for prg in ghc ghci ghc-${ghc.version} ghci-${ghc.version} runghc runhaskell; do + makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\")" + done + for prg in ghc-pkg ghc-pkg-${ghc.version}; do + makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\" --package-conf=)" + done + ensureDir $out/nix-support + ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages + ''; - setupHook = ./setup-hook.sh; + GHCGetPackages = ./ghc-get-packages.sh; inherit ghc; ghcVersion = ghc.version; |