Skip to content

Commit 4a4d853

Browse files
committed
ci: try to build all nixos configuration as part of checks
1 parent e941b58 commit 4a4d853

File tree

6 files changed

+55
-2
lines changed

6 files changed

+55
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build nixos system
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
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: cachix/install-nix-action@v30
17+
- uses: cachix/cachix-action@v15
18+
with:
19+
name: kidibox
20+
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
21+
- id: set-matrix
22+
name: Generate Nix Matrix
23+
run: |
24+
nix build .nixosConfigurations.nixos.config.system.build.toplevel

.github/workflows/nix-github-actions.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616
- uses: cachix/install-nix-action@v30
17+
- uses: cachix/cachix-action@v15
18+
with:
19+
name: kidibox
20+
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
1721
- id: set-matrix
1822
name: Generate Nix Matrix
1923
run: |

checks/deploy/default.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{ inputs, ... }:
2+
builtins.mapAttrs (_: deployLib: deployLib.deployChecks inputs.self.deploy) inputs.deploy-rs.lib
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
22
inputs,
33
pkgs,
4+
config,
45
...
56
}:
67
let
7-
inherit (inputs) git-hooks-nix;
8+
inherit (inputs) git-hooks-nix treefmt-nix;
9+
treefmt = treefmt-nix.lib.evalModule pkgs ../../treefmt.nix;
810
in
911
git-hooks-nix.lib.${pkgs.system}.run {
1012
src = ./.;
1113
hooks = {
1214
treefmt = {
1315
enable = true;
14-
packageOverrides.treefmt = inputs.treefmt-nix.lib.mkWrapper pkgs ../../treefmt.nix;
16+
package = treefmt.config.build.wrapper;
1517
};
1618
};
1719
}

checks/treefmt/default.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
inputs,
3+
pkgs,
4+
...
5+
}:
6+
let
7+
inherit (inputs) treefmt-nix;
8+
treefmt = treefmt-nix.lib.evalModule pkgs ../../treefmt.nix;
9+
in
10+
treefmt.config.build.check inputs.self

flake.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,17 @@
122122

123123
outputs-builder = channels: {
124124
formatter = inputs.treefmt-nix.lib.mkWrapper channels.nixpkgs ./treefmt.nix;
125+
# checks =
126+
# let
127+
# inherit (channels.nixpkgs) system;
128+
# # FIXME: need to filter on system
129+
# # deploy = inputs.deploy-rs.lib.${system}.deployChecks self.deploy;
130+
# nixosMachines = lib.mapAttrs' (
131+
# name: config: lib.nameValuePair "nixosConfiguration-${name}" config.config.system.build.toplevel
132+
# ) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
133+
# # devShells = lib.mapAttrs' (n: lib.nameValuePair "devShells-${n}") self.devShells;
134+
# in
135+
# nixosMachines;
125136
};
126137
})
127138
// {

0 commit comments

Comments
 (0)