···11# Checks pkgs/by-name (see pkgs/by-name/README.md)
22-# using the nixpkgs-check-by-name tool (see pkgs/test/nixpkgs-check-by-name)
22+# using the nixpkgs-check-by-name tool (see https://github.com/NixOS/nixpkgs-check-by-name)
33#
44-# When you make changes to this workflow, also update pkgs/test/nixpkgs-check-by-name/scripts/run-local.sh adequately
44+# When you make changes to this workflow, also update pkgs/test/check-by-name/run-local.sh adequately
55name: Check pkgs/by-name
6677-# The tool is pinned to a pre-built version on Hydra,
88-# see pkgs/test/nixpkgs-check-by-name/scripts/README.md
97on:
108 # Using pull_request_target instead of pull_request avoids having to approve first time contributors
119 pull_request_target:
···24222523jobs:
2624 check:
2727- # This is x86_64-linux, for which the tool is always prebuilt on the nixos-* channels,
2828- # as specified in nixos/release-combined.nix
2525+ # This needs to be x86_64-linux, because we depend on the tooling being pre-built in the GitHub releases
2926 runs-on: ubuntu-latest
3027 # This should take 1 minute at most, but let's be generous.
3128 # The default of 6 hours is definitely too long
···10097 echo "base=$base" >> "$GITHUB_ENV"
10198 - uses: cachix/install-nix-action@8887e596b4ee1134dae06b98d573bd674693f47c # v26
10299 - name: Fetching the pinned tool
103103- # Update the pinned version using pkgs/test/nixpkgs-check-by-name/scripts/update-pinned-tool.sh
100100+ # Update the pinned version using pkgs/test/check-by-name/update-pinned-tool.sh
104101 run: |
105105- # Get the direct /nix/store path from the pin to avoid having to evaluate Nixpkgs
106106- toolPath=$(jq -r '."ci-path"' pkgs/test/nixpkgs-check-by-name/scripts/pinned-tool.json)
107107- # This asks the substituter for the path, which should be there because Hydra will have pre-built and pushed it
102102+ # The pinned version of the tooling to use
103103+ toolVersion=$(<pkgs/test/check-by-name/pinned-version.txt)
104104+ # Fetch the x86_64-linux-specific release artifact containing the Gzipped NAR of the pre-built tool
105105+ toolPath=$(curl -sSfL https://github.com/NixOS/nixpkgs-check-by-name/releases/download/"$toolVersion"/x86_64-linux.nar.gz \
106106+ | gzip -cd | nix-store --import | tail -1)
107107+ # Adds a result symlink as a GC root
108108 nix-store --realise "$toolPath" --add-root result
109109 - name: Running nixpkgs-check-by-name
110110 run: |
+1-1
maintainers/scripts/README.md
···11111212### `check-by-name.sh`
13131414-An alias for `pkgs/test/nixpkgs-check-by-name/scripts/run-local.sh`, see [documentation](../../pkgs/test/nixpkgs-check-by-name/scripts/README.md).
1414+An alias for `pkgs/test/check-by-name/run-local.sh`, see [documentation](../../pkgs/test/check-by-name/README.md).
15151616### `get-maintainer.sh`
1717
···169169 (onFullSupported "nixpkgs.jdk")
170170 (onSystems ["x86_64-linux"] "nixpkgs.mesa_i686") # i686 sanity check + useful
171171 ["nixpkgs.tarball"]
172172-173173- # Ensure that nixpkgs-check-by-name is available in nixos-unstable,
174174- # so that a pre-built version can be used in CI for PR's
175175- # See ../pkgs/test/nixpkgs-check-by-name/README.md
176176- (onSystems ["x86_64-linux"] "nixpkgs.tests.nixpkgs-check-by-name")
177172 ];
178173 };
179174}
+3-3
pkgs/by-name/README.md
···108108109109## Validation
110110111111-CI performs [certain checks](../test/nixpkgs-check-by-name/README.md#validity-checks) on the `pkgs/by-name` structure.
112112-This is done using the [`nixpkgs-check-by-name` tool](../test/nixpkgs-check-by-name).
111111+CI performs [certain checks](https://github.com/NixOS/nixpkgs-check-by-name?tab=readme-ov-file#validity-checks) on the `pkgs/by-name` structure.
112112+This is done using the [`nixpkgs-check-by-name` tool](https://github.com/NixOS/nixpkgs-check-by-name).
113113114114You can locally emulate the CI check using
115115116116```
117117-$ ./pkgs/test/nixpkgs-check-by-name/scripts/run-local.sh master
117117+$ ./maintainers/scripts/check-by-name.sh master
118118```
119119120120See [here](../../.github/workflows/check-by-name.yml) for more info.
···11-# CI-related Scripts
11+# `pkgs/by-name` check CI scripts
2233This directory contains scripts and files used and related to the CI running the `pkgs/by-name` checks in Nixpkgs.
44-See also the [CI GitHub Action](../../../../.github/workflows/check-by-name.yml).
44+See also the [CI GitHub Action](../../../.github/workflows/check-by-name.yml).
5566## `./run-local.sh BASE_BRANCH [REPOSITORY]`
77···18181919## `./update-pinned-tool.sh`
20202121-Updates the pinned CI tool in [`./pinned-tool.json`](./pinned-tool.json) to the
2222-[latest version from the `nixos-unstable` channel](https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.tests.nixpkgs-check-by-name.x86_64-linux).
2121+Updates the pinned [nixpkgs-check-by-name tool](https://github.com/NixOS/nixpkgs-check-by-name) in [`./pinned-version.txt`](./pinned-version.txt) to the latest [release](https://github.com/NixOS/nixpkgs-check-by-name/releases).
2222+Each release contains a pre-built x86_64-linux version of the tool which is used by CI.
23232424-This script needs to be called manually when the CI tooling needs to be updated.
2525-2626-The `pinned-tool.json` file gets populated with both:
2727-- The `/nix/store` path for `x86_64-linux`, such that CI doesn't have to evaluate Nixpkgs and can directly fetch it from the cache instead.
2828-- The Nixpkgs revision, such that the `./run-local.sh` script can be used to run the checks locally on any system.
2929-3030-To ensure that the tool is always pre-built for `x86_64-linux` in the `nixos-unstable` channel,
3131-it's included in the `tested` jobset description in [`nixos/release-combined.nix`](../../../nixos/release-combined.nix).
2424+This script currently needs to be called manually when the CI tooling needs to be updated.
32253326Why not just build the tooling right from the PRs Nixpkgs version?
3427- Because it allows CI to check all PRs, even if they would break the CI tooling.
···11-#!/usr/bin/env nix-shell
22-#!nix-shell -i bash -p jq
33-44-set -o pipefail -o errexit -o nounset
55-66-trace() { echo >&2 "$@"; }
77-88-SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
99-1010-# Determined by `runs-on: ubuntu-latest` in .github/workflows/check-by-name.yml
1111-CI_SYSTEM=x86_64-linux
1212-1313-channel=nixos-unstable
1414-pin_file=$SCRIPT_DIR/pinned-tool.json
1515-1616-trace -n "Fetching latest version of channel $channel.. "
1717-# This is probably the easiest way to get Nix to output the path to a downloaded channel!
1818-nixpkgs=$(nix-instantiate --find-file nixpkgs -I nixpkgs=channel:"$channel")
1919-trace "$nixpkgs"
2020-2121-# This file only exists in channels
2222-rev=$(<"$nixpkgs/.git-revision")
2323-trace -e "Git revision of channel $channel is \e[34m$rev\e[0m"
2424-2525-trace -n "Fetching the prebuilt version of nixpkgs-check-by-name for $CI_SYSTEM.. "
2626-# This is the architecture used by CI, we want to prefetch the exact path to avoid having to evaluate Nixpkgs
2727-ci_path=$(nix-build --no-out-link "$nixpkgs" \
2828- -A tests.nixpkgs-check-by-name \
2929- --arg config '{}' \
3030- --argstr system "$CI_SYSTEM" \
3131- --arg overlays '[]' \
3232- -j 0 \
3333- | tee /dev/stderr)
3434-3535-trace "Updating $pin_file"
3636-jq -n \
3737- --arg rev "$rev" \
3838- --arg ci-path "$ci_path" \
3939- '$ARGS.named' \
4040- > "$pin_file"