From 88c9a92624c7e44396390b03c27dbb6212962f3b Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sun, 27 Nov 2022 08:06:18 -0600 Subject: Nim: resurrect bootstrap compiler Building the bootstrap and the unwrapped compiler in seperate derivations is still worthwhile because if we patch the compiler only need to rebuild the second of the two. --- pkgs/development/compilers/nim/default.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'pkgs/development/compilers/nim') diff --git a/pkgs/development/compilers/nim/default.nix b/pkgs/development/compilers/nim/default.nix index 6f1c08bf245f5..d5abc06c834dc 100644 --- a/pkgs/development/compilers/nim/default.nix +++ b/pkgs/development/compilers/nim/default.nix @@ -71,6 +71,17 @@ let nimHost = parsePlatform stdenv.hostPlatform; nimTarget = parsePlatform stdenv.targetPlatform; + + bootstrapCompiler = stdenv.mkDerivation { + pname = "nim-bootstrap"; + inherit (nim-unwrapped) version src; + enableParallelBuilding = true; + installPhase = '' + runHook preInstall + install -Dt $out/bin bin/nim + runHook postInstall + ''; + }; in { nim-unwrapped = stdenv.mkDerivation rec { @@ -95,6 +106,7 @@ in { configurePhase = '' runHook preConfigure + cp ${bootstrapCompiler}/bin/nim bin/ echo 'define:nixbuild' >> config/nim.cfg runHook postConfigure ''; @@ -112,7 +124,6 @@ in { '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) '' sed -i "s/aarch64/arm64/g" makefile '' + '' - make -j$NIX_BUILD_CORES ./bin/nim c --parallelBuild:$NIX_BUILD_CORES koch ./koch boot $kochArgs --parallelBuild:$NIX_BUILD_CORES ./koch toolsNoExternal $kochArgs --parallelBuild:$NIX_BUILD_CORES -- cgit 1.4.1