Skip to content

Commit cbe33ab

Browse files
committed
[WIP] set up nix-github-actions
1 parent 212b20e commit cbe33ab

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Nix Flake actions
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
nix-matrix:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
matrix: ${{ steps.set-matrix.outputs.matrix }}
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: cachix/install-nix-action@v30
15+
- id: set-matrix
16+
name: Generate Nix Matrix
17+
run: |
18+
set -Eeu
19+
matrix="$(nix eval --json '.#githubActions.matrix')"
20+
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
21+
22+
nix-build:
23+
name: ${{ matrix.name }} (${{ matrix.system }})
24+
needs: nix-matrix
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: cachix/install-nix-action@v30
31+
- run: nix build -L '.#${{ matrix.attr }}'

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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
1414
git-hooks.url = "github:cachix/git-hooks.nix";
1515
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
16+
nix-github-actions.url = "github:nix-community/nix-github-actions";
17+
nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
1618
};
1719

1820
outputs =
@@ -35,6 +37,7 @@
3537
nix/nixpkgs.nix
3638
nix/packages
3739
nix/overlays
40+
nix/github-actions.nix
3841
];
3942
});
4043
}

nix/github-actions.nix

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

0 commit comments

Comments
 (0)