Skip to content

Commit 99b1a13

Browse files
committed
chore: set up nix-github-actions
1 parent fec4e53 commit 99b1a13

File tree

4 files changed

+49
-12
lines changed

4 files changed

+49
-12
lines changed

.github/workflows/nix-build.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,27 @@ permissions:
1515
packages: write
1616

1717
jobs:
18+
nix-matrix:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
matrix: ${{ steps.set-matrix.outputs.matrix }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: cachix/install-nix-action@v30
25+
- id: set-matrix
26+
name: Generate Nix Matrix
27+
run: |
28+
set -Eeu
29+
matrix="$(nix eval --json '.#githubActions.matrix')"
30+
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
31+
1832
build-run-image:
33+
name: ${{ matrix.name }} (${{ matrix.system }})
34+
needs: nix-matrix
35+
runs-on: ${{ matrix.os }}
1936
strategy:
2037
fail-fast: false
21-
matrix:
22-
include:
23-
- runner: large-linux-x86
24-
arch: amd64
25-
- runner: large-linux-arm
26-
arch: arm64
27-
- runner: macos-latest-xlarge
28-
arch: arm64
29-
runs-on: ${{ matrix.runner }}
38+
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
3039
timeout-minutes: 180
3140
steps:
3241
- name: Checkout Repo
@@ -104,9 +113,7 @@ jobs:
104113
sudo rm -rf /tmp/* 2>/dev/null || true
105114
echo "=== AFTER CLEANUP ==="
106115
df -h
107-
- name: Build psql bundle
108-
run: >
109-
nix build ".#checks.$(nix eval --raw --impure --expr 'builtins.currentSystem')"
116+
- run: nix build -L '.#${{ matrix.attr }}'
110117
env:
111118
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
112119
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}

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
@@ -14,6 +14,8 @@
1414
git-hooks.url = "github:cachix/git-hooks.nix";
1515
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
1616
nixpkgs-go124.url = "github:Nixos/nixpkgs/d2ac4dfa61fba987a84a0a81555da57ae0b9a2b0";
17+
nix-github-actions.url = "github:nix-community/nix-github-actions";
18+
nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
1719
};
1820

1921
outputs =
@@ -36,6 +38,7 @@
3638
nix/nixpkgs.nix
3739
nix/packages
3840
nix/overlays
41+
nix/github-actions.nix
3942
];
4043
});
4144
}

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)