stdenv: Allow user to supply their bootstrapFiles set of tools

This commit is contained in:
w 2024-06-05 04:19:38 +00:00
parent 0721823d6c
commit d7ec977f86
3 changed files with 32 additions and 3 deletions

View File

@ -15,11 +15,12 @@
overlays,
crossOverlays ? [ ],
# Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools
bootstrapFiles ?
bootstrapFiles ? (config.replaceBootstrapFiles or lib.id) (
if localSystem.isAarch64 then
import ./bootstrap-files/aarch64-apple-darwin.nix
else
import ./bootstrap-files/x86_64-apple-darwin.nix,
import ./bootstrap-files/x86_64-apple-darwin.nix
),
}:
assert crossSystem == localSystem;

View File

@ -94,7 +94,7 @@
or (throw "unsupported libc for the pure Linux stdenv");
files = archLookupTable.${localSystem.system} or (if getCompatibleTools != null then getCompatibleTools
else (throw "unsupported platform for the pure Linux stdenv"));
in files
in (config.replaceBootstrapFiles or lib.id) files
}:
assert crossSystem == localSystem;

View File

@ -134,6 +134,34 @@ let
feature = "build packages with CUDA support by default";
};
replaceBootstrapFiles = mkMassRebuild {
type = types.functionTo (types.attrsOf types.package);
default = lib.id;
defaultText = literalExpression "lib.id";
description = ''
Use the bootstrap files returned instead of the default bootstrap
files.
The default bootstrap files are passed as an argument.
'';
example = literalExpression ''
prevFiles:
let
replacements = {
"sha256-YQlr088HPoVWBU2jpPhpIMyOyoEDZYDw1y60SGGbUM0=" = import <nix/fetchurl.nix> {
url = "(custom glibc linux x86_64 bootstrap-tools.tar.xz)";
hash = "(...)";
};
"sha256-QrTEnQTBM1Y/qV9odq8irZkQSD9uOMbs2Q5NgCvKCNQ=" = import <nix/fetchurl.nix> {
url = "(custom glibc linux x86_64 busybox)";
hash = "(...)";
executable = true;
};
};
in
builtins.mapAttrs (name: prev: replacements.''${prev.outputHash} or prev) prevFiles
'';
};
rocmSupport = mkMassRebuild {
type = types.bool;
default = false;