Skip to content

Commit

Permalink
stdenv: Allow user to supply their bootstrapFiles set of tools
Browse files Browse the repository at this point in the history
  • Loading branch information
w committed Aug 30, 2024
1 parent 0721823 commit d7ec977
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/stdenv/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 28 additions & 0 deletions pkgs/top-level/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d7ec977

Please sign in to comment.