From 46bb6a78dbcf293dc651b8bcb02f16e6d78b24ae Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 26 Feb 2022 13:28:12 +0100 Subject: [PATCH 1/2] haskellPackages.callCabal2nix: Use stdenvNoCC Delays C compiler realisation to the actual build, which is more parallelizable; doesn't block the evaluator. --- pkgs/development/haskell-modules/make-package-set.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index e9ce4f127051..705a5b3e96f0 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -124,7 +124,7 @@ let haskellSrc2nix = { name, src, sha256 ? null, extraCabal2nixOptions ? "" }: let sha256Arg = if sha256 == null then "--sha256=" else ''--sha256="${sha256}"''; - in buildPackages.stdenv.mkDerivation { + in buildPackages.stdenvNoCC.mkDerivation { name = "cabal2nix-${name}"; nativeBuildInputs = [ buildPackages.cabal2nix-unwrapped ]; preferLocalBuild = true; From b4524d8eda7fae5fc81e83286a402a37526220eb Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 26 Feb 2022 13:38:11 +0100 Subject: [PATCH 2/2] haskellPackages.haskellSrc2nix: stdenvNoCC.mkDerivation -> runCommand No need to fuss with phases. --- .../haskell-modules/make-package-set.nix | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index 705a5b3e96f0..86f29e731133 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -124,20 +124,17 @@ let haskellSrc2nix = { name, src, sha256 ? null, extraCabal2nixOptions ? "" }: let sha256Arg = if sha256 == null then "--sha256=" else ''--sha256="${sha256}"''; - in buildPackages.stdenvNoCC.mkDerivation { - name = "cabal2nix-${name}"; + in buildPackages.runCommand "cabal2nix-${name}" { nativeBuildInputs = [ buildPackages.cabal2nix-unwrapped ]; preferLocalBuild = true; allowSubstitutes = false; - phases = ["installPhase"]; LANG = "en_US.UTF-8"; LOCALE_ARCHIVE = pkgs.lib.optionalString (buildPlatform.libc == "glibc") "${buildPackages.glibcLocales}/lib/locale/locale-archive"; - installPhase = '' - export HOME="$TMP" - mkdir -p "$out" - cabal2nix --compiler=${self.ghc.haskellCompilerName} --system=${hostPlatform.config} ${sha256Arg} "${src}" ${extraCabal2nixOptions} > "$out/default.nix" - ''; - }; + } '' + export HOME="$TMP" + mkdir -p "$out" + cabal2nix --compiler=${self.ghc.haskellCompilerName} --system=${hostPlatform.config} ${sha256Arg} "${src}" ${extraCabal2nixOptions} > "$out/default.nix" + ''; all-cabal-hashes-component = name: version: buildPackages.runCommand "all-cabal-hashes-component-${name}-${version}" {} '' tar --wildcards -xzvf ${all-cabal-hashes} \*/${name}/${version}/${name}.{json,cabal}