From ea52ca64e8fe1553316f851cb8a4a542e8b120ad Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Sun, 3 Jun 2018 17:28:17 -0400 Subject: [PATCH] Fix GHCJS 8.4/8.2 in sandboxed builds (#41411) --- .../compilers/ghcjs-ng/configured-ghcjs-src.nix | 7 ++++++- pkgs/development/compilers/ghcjs-ng/default.nix | 9 ++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix b/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix index e8c24b21134..57d9fccd266 100644 --- a/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix +++ b/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix @@ -6,6 +6,8 @@ , cabal-install , gmp , runCommand +, lib +, stdenv , ghc , happy @@ -20,15 +22,18 @@ runCommand "configured-ghcjs-src" { autoconf automake python3 - gcc ghc happy alex cabal-install + ] ++ lib.optionals stdenv.isDarwin [ + gcc # https://github.com/ghcjs/ghcjs/issues/663 ]; inherit ghcjsSrc; } '' export HOME=$(pwd) + mkdir $HOME/.cabal + touch $HOME/.cabal/config cp -r "$ghcjsSrc" "$out" chmod -R +w "$out" cd "$out" diff --git a/pkgs/development/compilers/ghcjs-ng/default.nix b/pkgs/development/compilers/ghcjs-ng/default.nix index 7f13c373942..04c3431f6f2 100644 --- a/pkgs/development/compilers/ghcjs-ng/default.nix +++ b/pkgs/development/compilers/ghcjs-ng/default.nix @@ -50,13 +50,10 @@ let }; bootGhcjs = haskellLib.justStaticExecutables passthru.bootPkgs.ghcjs; - libexec = - if builtins.compareVersions bootGhcjs.version "8.3" <= 0 - then "${bootGhcjs}/bin" - else "${bootGhcjs}/libexec/${builtins.replaceStrings ["darwin"] ["osx"] stdenv.system}-${passthru.bootPkgs.ghc.name}/${bootGhcjs.name}"; + libexec = "${bootGhcjs}/libexec/${builtins.replaceStrings ["darwin"] ["osx"] stdenv.system}-${passthru.bootPkgs.ghc.name}/${bootGhcjs.name}"; in stdenv.mkDerivation { - name = "ghcjs"; + name = bootGhcjs.name; src = passthru.configuredSrc; nativeBuildInputs = [ bootGhcjs @@ -73,6 +70,8 @@ in stdenv.mkDerivation { phases = ["unpackPhase" "buildPhase"]; buildPhase = '' export HOME=$TMP + mkdir $HOME/.cabal + touch $HOME/.cabal/config cd lib/boot mkdir -p $out/bin