Skip to content

Commit 0a74b49

Browse files
authored
Merge pull request #14332 from NixOS/cleanup-ci
ci: Assorted collection of cleanups
2 parents d74177d + 3c83856 commit 0a74b49

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

.github/actions/install-nix-action/action.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ inputs:
1616
install_url:
1717
description: "URL of the Nix installer"
1818
required: false
19-
default: "https://releases.nixos.org/nix/nix-2.30.2/install"
19+
default: "https://releases.nixos.org/nix/nix-2.32.1/install"
2020
tarball_url:
2121
description: "URL of the Nix tarball to use with the experimental installer"
2222
required: false
2323
github_token:
2424
description: "Github token"
2525
required: true
26+
use_cache:
27+
description: "Whether to setup magic-nix-cache"
28+
default: true
29+
required: false
2630
runs:
2731
using: "composite"
2832
steps:
@@ -118,3 +122,10 @@ runs:
118122
source-url: ${{ inputs.experimental-installer-version != 'latest' && 'https://artifacts.nixos.org/experimental-installer/tag/${{ inputs.experimental-installer-version }}/${{ env.EXPERIMENTAL_INSTALLER_ARTIFACT }}' || '' }}
119123
nix-package-url: ${{ inputs.dogfood == 'true' && steps.download-nix-installer.outputs.tarball-path || (inputs.tarball_url || '') }}
120124
extra-conf: ${{ inputs.extra_nix_config }}
125+
- uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
126+
if: ${{ inputs.use_cache == 'true' }}
127+
with:
128+
diagnostic-endpoint: ''
129+
use-flakehub: false
130+
use-gha-cache: true
131+
source-revision: c2f46a0afa5f95fd4c184a533afd280c68cf63ff # v0.1.6

.github/workflows/ci.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
extra_nix_config:
3030
experimental-features = nix-command flakes
3131
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
use_cache: false
3233
- run: nix flake show --all-systems --json
3334

3435
pre-commit-checks:
@@ -41,7 +42,6 @@ jobs:
4142
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
4243
extra_nix_config: experimental-features = nix-command flakes
4344
github_token: ${{ secrets.GITHUB_TOKEN }}
44-
- uses: DeterminateSystems/magic-nix-cache-action@main
4545
- run: ./ci/gha/tests/pre-commit-checks
4646

4747
basic-checks:
@@ -92,7 +92,6 @@ jobs:
9292
dogfood: ${{ github.event_name == 'workflow_dispatch' && inputs.dogfood || github.event_name != 'workflow_dispatch' }}
9393
# The sandbox would otherwise be disabled by default on Darwin
9494
extra_nix_config: "sandbox = true"
95-
- uses: DeterminateSystems/magic-nix-cache-action@main
9695
# Since ubuntu 22.30, unprivileged usernamespaces are no longer allowed to map to the root user:
9796
# https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces
9897
- run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
@@ -171,7 +170,7 @@ jobs:
171170
echo "installer-url=file://$GITHUB_WORKSPACE/out" >> "$GITHUB_OUTPUT"
172171
TARBALL_PATH="$(find "$GITHUB_WORKSPACE/out" -name 'nix*.tar.xz' -print | head -n 1)"
173172
echo "tarball-path=file://$TARBALL_PATH" >> "$GITHUB_OUTPUT"
174-
- uses: cachix/install-nix-action@v31
173+
- uses: cachix/install-nix-action@c134e4c9e34bac6cab09cf239815f9339aaaf84e # v31.5.1
175174
if: ${{ !matrix.experimental-installer }}
176175
with:
177176
install_url: ${{ format('{0}/install', steps.installer-tarball-url.outputs.installer-url) }}
@@ -227,12 +226,13 @@ jobs:
227226
- uses: actions/checkout@v5
228227
with:
229228
fetch-depth: 0
230-
- uses: cachix/install-nix-action@v31
229+
- uses: ./.github/actions/install-nix-action
231230
with:
232-
install_url: https://releases.nixos.org/nix/nix-2.20.3/install
233-
- uses: DeterminateSystems/magic-nix-cache-action@main
234-
- run: echo NIX_VERSION="$(nix --experimental-features 'nix-command flakes' eval .\#nix.version | tr -d \")" >> $GITHUB_ENV
235-
- run: nix --experimental-features 'nix-command flakes' build .#dockerImage -L
231+
dogfood: false
232+
extra_nix_config: |
233+
experimental-features = flakes nix-command
234+
- run: echo NIX_VERSION="$(nix eval .\#nix.version | tr -d \")" >> $GITHUB_ENV
235+
- run: nix build .#dockerImage -L
236236
- run: docker load -i ./result/image.tar.gz
237237
- run: docker tag nix:$NIX_VERSION ${{ secrets.DOCKERHUB_USERNAME }}/nix:$NIX_VERSION
238238
- run: docker tag nix:$NIX_VERSION ${{ secrets.DOCKERHUB_USERNAME }}/nix:master
@@ -289,7 +289,6 @@ jobs:
289289
extra_nix_config:
290290
experimental-features = nix-command flakes
291291
github_token: ${{ secrets.GITHUB_TOKEN }}
292-
- uses: DeterminateSystems/magic-nix-cache-action@main
293292
- run: nix build -L --out-link ./new-nix && PATH=$(pwd)/new-nix/bin:$PATH MAX_FLAKES=25 flake-regressions/eval-all.sh
294293

295294
profile_build:
@@ -310,7 +309,6 @@ jobs:
310309
extra_nix_config: |
311310
experimental-features = flakes nix-command ca-derivations impure-derivations
312311
max-jobs = 1
313-
- uses: DeterminateSystems/magic-nix-cache-action@main
314312
- run: |
315313
nix build -L --file ./ci/gha/profile-build buildTimeReport --out-link build-time-report.md
316314
cat build-time-report.md >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)