From d7ec977f86e140b118864e5956f19d544ee28d72 Mon Sep 17 00:00:00 2001 From: w Date: Wed, 5 Jun 2024 04:19:38 +0000 Subject: [PATCH] stdenv: Allow user to supply their bootstrapFiles set of tools --- pkgs/stdenv/darwin/default.nix | 5 +++-- pkgs/stdenv/linux/default.nix | 2 +- pkgs/top-level/config.nix | 28 ++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 13d53ad6e678..dce0de939d5a 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 c5e0498de66a..91ea577570f2 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 67a9a60dbaea..a4e1116a16dd 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;