diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 13d53ad6e67818..dce0de939d5ae0 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -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; diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index c5e0498de66a4e..91ea577570f2cc 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -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; diff --git a/pkgs/top-level/config.nix b/pkgs/top-level/config.nix index 67a9a60dbaeaa3..a4e1116a16dd03 100644 --- a/pkgs/top-level/config.nix +++ b/pkgs/top-level/config.nix @@ -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 { + url = "(custom glibc linux x86_64 bootstrap-tools.tar.xz)"; + hash = "(...)"; + }; + "sha256-QrTEnQTBM1Y/qV9odq8irZkQSD9uOMbs2Q5NgCvKCNQ=" = import { + 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;