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.
This commit is contained in:
Emery Hemingway 2022-11-27 08:06:18 -06:00
parent 6c492a6936
commit 88c9a92624

View File

@ -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