stdenv: Allow user to supply their bootstrapFiles set of tools (#317119)

This commit is contained in:
Philip Taron 2024-09-04 11:34:37 -07:00 committed by GitHub
commit 8ed9f95120
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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;