-
Notifications
You must be signed in to change notification settings - Fork 5
91 lines (76 loc) · 2.5 KB
/
Copy pathnix.yml
File metadata and controls
91 lines (76 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Test Nix Flake
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
nix-flake-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.0
with:
submodules: recursive
- uses: cachix/install-nix-action@v31.10.6
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: nix flake check for all platforms
run: |
nix flake check --all-systems
nix-build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.0
with:
submodules: recursive
- uses: cachix/install-nix-action@v31.10.6
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: nix build . for x86_64-linux
run: nix build .
nix-build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v7.0.0
with:
submodules: recursive
- uses: cachix/install-nix-action@v31.10.6
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: nix build . for x86_64-darwin
run: nix build .
nix-fix-hashes:
needs: nix-build-linux
if: ${{ always() && !cancelled() && needs.nix-build-linux.result == 'failure' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7.0.0
with:
submodules: recursive
ref: ${{ github.head_ref }}
- uses: DeterminateSystems/determinate-nix-action@v3.21.5
- name: Build and collect hash mismatches
id: nix_build
continue-on-error: true
run: nix build .#default -L --keep-going
- name: Fix hash mismatches
if: ${{ steps.nix_build.outcome == 'failure' }}
env:
PR_HEAD_REF: ${{ github.head_ref }}
run: |
determinate-nixd fix hashes --auto-apply
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add --update --ignore-removal .
if ! git diff --cached --quiet; then
git commit -m "[dependabot skip] Automatically fix Nix hashes"
git push origin "HEAD:${PR_HEAD_REF}"
else
echo "No Nix hash changes were produced."
exit 1
fi