diff options
author | Emery Hemingway <ehmry@posteo.net> | 2022-11-27 08:06:18 -0600 |
---|---|---|
committer | Emery Hemingway <ehmry@posteo.net> | 2022-11-28 12:28:25 -0600 |
commit | 88c9a92624c7e44396390b03c27dbb6212962f3b (patch) | |
tree | 7597eee630c635649192727c3d6c3ebadf8379bd /pkgs/development/compilers/nim | |
parent | 6c492a6936ce806ce5a73b7d21ca8f56f15a231b (diff) |
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.
Diffstat (limited to 'pkgs/development/compilers/nim')
-rw-r--r-- | pkgs/development/compilers/nim/default.nix | 13 |
1 files changed, 12 insertions, 1 deletions
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 |