File tree Expand file tree Collapse file tree 4 files changed +86
-1
lines changed Expand file tree Collapse file tree 4 files changed +86
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Nix Flake Actions
2+ on :
3+ pull_request :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - master
8+ - main
9+
10+ jobs :
11+ nix-matrix :
12+ runs-on : ubuntu-latest
13+ outputs :
14+ matrix : ${{ steps.set-matrix.outputs.matrix }}
15+ steps :
16+ - uses : actions/checkout@v4
17+ - uses : cachix/install-nix-action@v27
18+ - id : set-matrix
19+ name : Generate Nix Matrix
20+ run : |
21+ set -Eeu
22+ matrix="$(nix eval --json '.#githubActions.matrix')"
23+ echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
24+
25+ nix-flake-checks :
26+ needs : nix-matrix
27+ runs-on : ${{ matrix.os }}
28+ strategy :
29+ matrix : ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
30+ steps :
31+ - uses : actions/checkout@v4
32+ - uses : cachix/install-nix-action@v27
33+ - uses : cachix/cachix-action@v15
34+ with :
35+ name : jaen-robotnix
36+ authToken : " ${{ secrets.CACHIX_AUTH_TOKEN }}"
37+ - run : nix build -L ".#${{ matrix.attr }}"
38+
39+ nix-flake-check-template :
40+ runs-on : ubuntu-latest
41+ steps :
42+ - uses : actions/checkout@v4
43+ - uses : cachix/install-nix-action@v27
44+ - uses : cachix/cachix-action@v15
45+ with :
46+ name : jaen-robotnix
47+ authToken : " ${{ secrets.CACHIX_AUTH_TOKEN }}"
48+ - name : " Check the robotnix flake"
49+ run : |
50+ # Don't run checks here, the `nix-flake-checks` job takes care of it
51+ nix flake check --no-build
52+ - name : " Check the templated robotnix flake"
53+ run : |
54+ export ORIG_DIR="$PWD"
55+ cd "$(mktemp -d)"
56+
57+ nix flake init -t "$ORIG_DIR"
58+ nix flake check --override-input robotnix "$ORIG_DIR"
Original file line number Diff line number Diff line change 1313
1414 treefmt-nix . url = "github:numtide/treefmt-nix" ;
1515 treefmt-nix . inputs . nixpkgs . follows = "nixpkgs-unstable" ;
16+
17+ nix-github-actions . url = "github:nix-community/nix-github-actions" ;
18+ nix-github-actions . inputs . nixpkgs . follows = "nixpkgs" ;
1619 } ;
1720
1821 outputs = args : import ./flake/outputs.nix args ;
Original file line number Diff line number Diff line change 66 flake-compat ,
77 treefmt ,
88 treefmt-nix ,
9+ nix-github-actions ,
910 ...
1011} @inputs :
1112let
8990 '' ;
9091 } ;
9192 } ;
93+
94+ githubActions = nix-github-actions . lib . mkGithubMatrix { inherit ( self ) checks ; } ;
9295}
You can’t perform that action at this time.
0 commit comments