From 1da4b5c99e4a8b85531d38922ce658cef1d7cfcc Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 7 Oct 2023 15:48:15 +0000 Subject: [PATCH] release.nix: namespace bootstrap tools with triples This will allow buliding bootstrap tools for platforms with non-default libcs, like *-unknown-linux-musl. This gets rid of limitedSupportSystems/systemsWithAnySupport. There was no need to use systemsWithAnySupport for supportDarwin, because it was always equivalent to supportedSystems for that purpose, and the only other way it was used was for determining which platforms to build the bootstrap tools for, so we might as well use a more explicit parameter for that, and then we can change how it works without affecting the rest of the Hydra jobs. Not affecting the rest of the Hydra jobs is important, because if we changed all jobs to use config triples, we'd end up renaming every Hydra job. That might still be worth thinking about at some point, but it's unnecessary at this point (and would be a lot of work). I've checked by running nix-eval-jobs --force-recurse pkgs/top-level/release.nix that the actual bootstrap tools derivations are unaffected by this change, and that the only other jobs that change are ones that depend on the hash of all of Nixpkgs. Of the other jobset entrypoints that end up importing pkgs/top-level/release.nix, none used the limitedSupportedSystems parameter, so they should all be unaffected as well. --- maintainers/scripts/all-tarballs.nix | 2 +- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 2 +- pkgs/top-level/release.nix | 27 ++++++++++++--------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/maintainers/scripts/all-tarballs.nix b/maintainers/scripts/all-tarballs.nix index 6a4de8a4b951..83236e6fa91e 100644 --- a/maintainers/scripts/all-tarballs.nix +++ b/maintainers/scripts/all-tarballs.nix @@ -12,5 +12,5 @@ import ../../pkgs/top-level/release.nix scrubJobs = false; # No need to evaluate on i686. supportedSystems = [ "x86_64-linux" ]; - limitedSupportedSystems = []; + bootstrapConfigs = []; } diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index 46ba25f8603b..448d6ecd9f17 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -211,7 +211,7 @@ in rec { }; bootstrapTools = derivation { - inherit (localSystem) system; + inherit (stdenv.hostPlatform) system; name = "bootstrap-tools"; builder = "${bootstrapFiles.tools}/bin/bash"; diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index ad5f351b9c87..cfd89a893862 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -10,9 +10,16 @@ */ { nixpkgs ? { outPath = (import ../../lib).cleanSource ../..; revCount = 1234; shortRev = "abcdef"; revision = "0000000000000000000000000000000000000000"; } , officialRelease ? false - # The platforms for which we build Nixpkgs. + # The platform doubles for which we build Nixpkgs. , supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] -, limitedSupportedSystems ? [ "i686-linux" ] + # The platform triples for which we build bootstrap tools. +, bootstrapConfigs ? [ + "aarch64-apple-darwin" + "aarch64-unknown-linux-gnu" + "i686-unknown-linux-gnu" + "x86_64-apple-darwin" + "x86_64-unknown-linux-gnu" + ] # Strip most of attributes when evaluating to spare memory usage , scrubJobs ? true # Attributes passed to nixpkgs. Don't build packages marked as unfree. @@ -35,12 +42,10 @@ with import ./release-lib.nix { inherit supportedSystems scrubJobs nixpkgsArgs; let - systemsWithAnySupport = supportedSystems ++ limitedSupportedSystems; - supportDarwin = lib.genAttrs [ "x86_64" "aarch64" - ] (arch: builtins.elem "${arch}-darwin" systemsWithAnySupport); + ] (arch: builtins.elem "${arch}-darwin" supportedSystems); nonPackageJobs = { tarball = import ./make-tarball.nix { inherit pkgs nixpkgs officialRelease supportedSystems; }; @@ -177,21 +182,21 @@ let }; stdenvBootstrapTools = with lib; - genAttrs systemsWithAnySupport (system: - if hasSuffix "-linux" system then + genAttrs bootstrapConfigs (config: + if hasInfix "-linux-" config then let bootstrap = import ../stdenv/linux/make-bootstrap-tools.nix { pkgs = import ../.. { - localSystem = { inherit system; }; + localSystem = { inherit config; }; }; }; in { inherit (bootstrap) dist test; } - else if hasSuffix "-darwin" system then + else if hasSuffix "-darwin" config then let bootstrap = import ../stdenv/darwin/make-bootstrap-tools.nix { - localSystem = { inherit system; }; + localSystem = { inherit config; }; }; in { # Lightweight distribution and test @@ -201,7 +206,7 @@ let #inherit (bootstrap.test-pkgs) stdenv; } else - abort "No bootstrap implementation for system: ${system}" + abort "No bootstrap implementation for system: ${config}" ); };