workflows/eval: load supportedSystems from JSON file

This is a refactor to prepare the next commit. It doesn't do much on its
own, but is separated for ease of review.
This commit is contained in:
Wolfgang Walther 2025-05-11 20:55:26 +02:00
parent 04721e38d1
commit 456a4697b1
No known key found for this signature in database
GPG key ID: B39893FA5F65CAE1
9 changed files with 23 additions and 21 deletions

View file

@ -26,7 +26,6 @@ jobs:
if: needs.get-merge-commit.outputs.mergedSha if: needs.get-merge-commit.outputs.mergedSha
outputs: outputs:
targetSha: ${{ steps.targetSha.outputs.targetSha }} targetSha: ${{ steps.targetSha.outputs.targetSha }}
systems: ${{ steps.systems.outputs.systems }}
steps: steps:
- name: Check out the PR at the test merge commit - name: Check out the PR at the test merge commit
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@ -47,11 +46,9 @@ jobs:
with: with:
extra_nix_config: sandbox = true extra_nix_config: sandbox = true
- name: Evaluate the list of all attributes and get the systems matrix - name: Evaluate the list of all attributes
id: systems
run: | run: |
nix-build nixpkgs/ci -A eval.attrpathsSuperset nix-build nixpkgs/ci -A eval.attrpathsSuperset
echo "systems=$(<result/systems.json)" >> "$GITHUB_OUTPUT"
- name: Upload the list of all attributes - name: Upload the list of all attributes
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@ -66,7 +63,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
system: ${{ fromJSON(needs.attrs.outputs.systems) }} system: ${{ fromJSON(needs.get-merge-commit.outputs.systems) }}
steps: steps:
- name: Enable swap - name: Enable swap
run: | run: |

View file

@ -6,6 +6,9 @@ on:
mergedSha: mergedSha:
description: "The merge commit SHA" description: "The merge commit SHA"
value: ${{ jobs.resolve-merge-commit.outputs.mergedSha }} value: ${{ jobs.resolve-merge-commit.outputs.mergedSha }}
systems:
description: "The supported systems"
value: ${{ jobs.resolve-merge-commit.outputs.systems }}
permissions: {} permissions: {}
@ -14,6 +17,7 @@ jobs:
runs-on: ubuntu-24.04-arm runs-on: ubuntu-24.04-arm
outputs: outputs:
mergedSha: ${{ steps.merged.outputs.mergedSha }} mergedSha: ${{ steps.merged.outputs.mergedSha }}
systems: ${{ steps.systems.outputs.systems }}
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with: with:
@ -40,4 +44,8 @@ jobs:
fi fi
;; ;;
esac esac
rm -rf base
- name: Load supported systems
id: systems
run: |
echo "systems=$(jq -c <base/ci/supportedSystems.json)" >> "$GITHUB_OUTPUT"

View file

@ -11,7 +11,7 @@ nix-build ci -A eval.full \
--arg evalSystems '["x86_64-linux" "aarch64-darwin"]' --arg evalSystems '["x86_64-linux" "aarch64-darwin"]'
``` ```
- `--max-jobs`: The maximum number of derivations to run at the same time. Only each [supported system](../supportedSystems.nix) gets a separate derivation, so it doesn't make sense to set this higher than that number. - `--max-jobs`: The maximum number of derivations to run at the same time. Only each [supported system](../supportedSystems.json) gets a separate derivation, so it doesn't make sense to set this higher than that number.
- `--cores`: The number of cores to use for each job. Recommended to set this to the amount of cores on your system divided by `--max-jobs`. - `--cores`: The number of cores to use for each job. Recommended to set this to the amount of cores on your system divided by `--max-jobs`.
- `chunkSize`: The number of attributes that are evaluated simultaneously on a single core. Lowering this decreases memory usage at the cost of increased evaluation time. If this is too high, there won't be enough chunks to process them in parallel, and will also increase evaluation time. - `chunkSize`: The number of attributes that are evaluated simultaneously on a single core. Lowering this decreases memory usage at the cost of increased evaluation time. If this is too high, there won't be enough chunks to process them in parallel, and will also increase evaluation time.
- `evalSystems`: The set of systems for which `nixpkgs` should be evaluated. Defaults to the four official platforms (`x86_64-linux`, `aarch64-linux`, `x86_64-darwin` and `aarch64-darwin`). - `evalSystems`: The set of systems for which `nixpkgs` should be evaluated. Defaults to the four official platforms (`x86_64-linux`, `aarch64-linux`, `x86_64-darwin` and `aarch64-darwin`).

View file

@ -26,14 +26,14 @@ let
"nixos" "nixos"
"pkgs" "pkgs"
".version" ".version"
"ci/supportedSystems.nix" "ci/supportedSystems.json"
] ]
); );
}; };
nix = nixVersions.nix_2_24; nix = nixVersions.nix_2_24;
supportedSystems = import ../supportedSystems.nix; supportedSystems = builtins.fromJSON (builtins.readFile ../supportedSystems.json);
attrpathsSuperset = attrpathsSuperset =
runCommand "attrpaths-superset.json" runCommand "attrpaths-superset.json"
@ -43,8 +43,6 @@ let
nix nix
time time
]; ];
env.supportedSystems = builtins.toJSON supportedSystems;
passAsFile = [ "supportedSystems" ];
} }
'' ''
export NIX_STATE_DIR=$(mktemp -d) export NIX_STATE_DIR=$(mktemp -d)
@ -58,7 +56,6 @@ let
--option restrict-eval true \ --option restrict-eval true \
--option allow-import-from-derivation false \ --option allow-import-from-derivation false \
--arg enableWarnings false > $out/paths.json --arg enableWarnings false > $out/paths.json
mv "$supportedSystemsPath" $out/systems.json
''; '';
singleSystem = singleSystem =

6
ci/supportedSystems.json Normal file
View file

@ -0,0 +1,6 @@
[
"aarch64-linux",
"aarch64-darwin",
"x86_64-linux",
"x86_64-darwin"
]

View file

@ -1,6 +0,0 @@
[
"aarch64-linux"
"aarch64-darwin"
"x86_64-linux"
"x86_64-darwin"
]

View file

@ -10,7 +10,7 @@
$ hydra-eval-jobs -I . pkgs/top-level/release-haskell.nix $ hydra-eval-jobs -I . pkgs/top-level/release-haskell.nix
*/ */
{ {
supportedSystems ? import ../../ci/supportedSystems.nix, supportedSystems ? builtins.fromJSON (builtins.readFile ../../ci/supportedSystems.json),
}: }:
let let

View file

@ -13,7 +13,7 @@
attrNamesOnly ? false, attrNamesOnly ? false,
# Set this to `null` to build for builtins.currentSystem only # Set this to `null` to build for builtins.currentSystem only
systems ? import ../../ci/supportedSystems.nix, systems ? builtins.fromJSON (builtins.readFile ../../ci/supportedSystems.json),
}: }:
let let
lib = import (path + "/lib"); lib = import (path + "/lib");

View file

@ -19,7 +19,7 @@
system ? builtins.currentSystem, system ? builtins.currentSystem,
officialRelease ? false, officialRelease ? false,
# The platform doubles for which we build Nixpkgs. # The platform doubles for which we build Nixpkgs.
supportedSystems ? import ../../ci/supportedSystems.nix, supportedSystems ? builtins.fromJSON (builtins.readFile ../../ci/supportedSystems.json),
# The platform triples for which we build bootstrap tools. # The platform triples for which we build bootstrap tools.
bootstrapConfigs ? [ bootstrapConfigs ? [
"aarch64-apple-darwin" "aarch64-apple-darwin"