Skip to content

Commit 99125b0

Browse files
committed
Add CI
1 parent 7862ab6 commit 99125b0

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

.github/workflows/nix.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Nix Flake actions
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
nix-matrix:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
matrix: ${{ steps.set-matrix.outputs.matrix }}
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: DeterminateSystems/nix-installer-action@main
17+
with:
18+
extra-conf: |
19+
experimental-features = nix-command flakes pipe-operators
20+
- uses: DeterminateSystems/magic-nix-cache-action@main
21+
- id: set-matrix
22+
name: Generate Nix Matrix
23+
run: |
24+
set -Eeu
25+
matrix="$(nix eval --json '.#githubActions.matrix')"
26+
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
27+
28+
nix-build:
29+
name: ${{ matrix.name }} (${{ matrix.system }})
30+
needs: nix-matrix
31+
runs-on: ${{ matrix.os }}
32+
strategy:
33+
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: DeterminateSystems/nix-installer-action@main
37+
with:
38+
extra-conf: |
39+
experimental-features = nix-command flakes pipe-operators
40+
- uses: DeterminateSystems/magic-nix-cache-action@main
41+
- run: nix build -L '.#${{ matrix.attr }}'

ci.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
inputs,
3+
lib,
4+
config,
5+
...
6+
}:
7+
{
8+
flake.githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
9+
checks = lib.getAttrs ["x86_64-linux"] config.flake.packages;
10+
};
11+
}

flake.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
url = "github:nix-community/nixos-generators";
4747
inputs.nixpkgs.follows = "nixpkgs";
4848
};
49+
50+
nix-github-actions = {
51+
url = "github:nix-community/nix-github-actions";
52+
inputs.nixpkgs.follows = "nixpkgs";
53+
};
4954
};
5055

5156
outputs =

0 commit comments

Comments
 (0)