Skip to content

Commit e96d525

Browse files
committed
feat(nix): add bun version check workflow for pull requests
Add a lightweight CI check that compares the bun version in package.json against the version provided by the nixpkgs revision in flake.lock, using `nix eval --inputs-from . --raw nixpkgs#bun.version`. This is much cheaper than a full `nix build` and directly targets the version mismatch problem that caused anomalyco#13300 (and recurred on dev with 1.3.10). The workflow only runs when package.json or flake.lock are touched, and completes in seconds rather than minutes. Supersedes anomalyco#13496 (which used `nix build` as suggested by @gigamonster256). Also related: anomalyco#12175 (nix-eval workflow), anomalyco#13302 (earlier nixpkgs bump).
1 parent 18fb19d commit e96d525

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: nix-bun-version-check
2+
3+
on:
4+
pull_request:
5+
branches: [dev]
6+
paths:
7+
- "package.json"
8+
- "flake.lock"
9+
- ".github/workflows/nix-bun-version-check.yml"
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
check:
20+
runs-on: blacksmith-4vcpu-ubuntu-2404
21+
timeout-minutes: 5
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v6
25+
26+
- name: Setup Nix
27+
uses: nixbuild/nix-quick-install-action@v34
28+
29+
- name: Check bun version matches nixpkgs
30+
run: |
31+
set -euo pipefail
32+
33+
pkg_bun=$(jq -r '.packageManager' package.json | sed 's/bun@//')
34+
nix_bun=$(nix eval --inputs-from . --raw nixpkgs#bun.version)
35+
36+
echo "package.json: bun@${pkg_bun}"
37+
echo "nixpkgs: bun@${nix_bun}"
38+
39+
if [ "$pkg_bun" != "$nix_bun" ]; then
40+
echo "::error::Bun version mismatch: package.json requires ${pkg_bun} but nixpkgs provides ${nix_bun}. Update flake.lock (nix flake update nixpkgs) or align package.json."
41+
exit 1
42+
fi
43+
44+
echo "Versions match."

0 commit comments

Comments
 (0)