From b1aadb38439dcf50b41e74a16f7a9638e20f8f36 Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Mon, 11 Mar 2024 11:11:52 -0700 Subject: [PATCH] lib: move the list of supportedSystems from pkgs/top-level/release.nix to lib/systems/doubles.nix This allows flakes which depend on `nixpkgs` to reference this list from `nixpkgs.lib.systems.doubles.builtOnNixosHydra`, which is a long name but very true. These are the doubles that are built on [Hydra](https://hydra.nixos.org/)! See also: - https://github.com/NixOS/rfcs/blob/master/rfcs/0046-platform-support-tiers.md - https://github.com/NixOS/rfcs/pull/112 (closed) --- lib/systems/doubles.nix | 6 +++++- pkgs/top-level/release-lib.nix | 4 ++-- pkgs/top-level/release.nix | 9 ++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index b4cd5acfcc5b2..997ed350a5cd1 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -5,6 +5,10 @@ let inherit (lib.systems.inspect) predicates; inherit (lib.attrsets) matchAttrs; + # The platform doubles for which we build Nixpkgs. + # See `pkgs/top-level/release.nix` for where this value is consumed. + builtOnNixosHydra = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + all = [ # Cygwin "i686-cygwin" "x86_64-cygwin" @@ -63,7 +67,7 @@ let filterDoubles = f: map parse.doubleFromSystem (lists.filter f allParsed); in { - inherit all; + inherit all builtOnNixosHydra; none = []; diff --git a/pkgs/top-level/release-lib.nix b/pkgs/top-level/release-lib.nix index a1dcc3e9f3349..bf1a76dfb9fcb 100644 --- a/pkgs/top-level/release-lib.nix +++ b/pkgs/top-level/release-lib.nix @@ -4,11 +4,11 @@ , scrubJobs ? true , # Attributes passed to nixpkgs. Don't build packages marked as unfree. nixpkgsArgs ? { config = { allowUnfree = false; inHydra = true; }; } +# Just the Nixpkgs library functions and data. +, lib ? (import ../../lib) }: let - lib = import ../../lib; - inherit (lib) addMetaAttrs any diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index f79352bf3ffef..cbc5db0268520 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -8,11 +8,11 @@ $ nix-build pkgs/top-level/release.nix -A coreutils.x86_64-linux */ -{ nixpkgs ? { outPath = (import ../../lib).cleanSource ../..; revCount = 1234; shortRev = "abcdef"; revision = "0000000000000000000000000000000000000000"; } +{ nixpkgs ? { outPath = lib.cleanSource ../..; revCount = 1234; shortRev = "abcdef"; revision = "0000000000000000000000000000000000000000"; } , system ? builtins.currentSystem , officialRelease ? false # The platform doubles for which we build Nixpkgs. -, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] +, supportedSystems ? lib.systems.doubles.builtOnNixosHydra # The platform triples for which we build bootstrap tools. , bootstrapConfigs ? [ "aarch64-apple-darwin" @@ -45,11 +45,14 @@ # pkgs/top-level/. # , attrNamesOnly ? false + +# Just the Nixpkgs library functions and data. +, lib ? (import ../../lib) }: let release-lib = import ./release-lib.nix { - inherit supportedSystems scrubJobs nixpkgsArgs system; + inherit supportedSystems scrubJobs nixpkgsArgs system lib; }; inherit (release-lib) mapTestOn pkgs;