From e96d5256872de76699c523e07205dee11cf5043f Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 2 Mar 2026 09:40:55 +0000 Subject: [PATCH] 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 #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 #13496 (which used `nix build` as suggested by @gigamonster256). Also related: #12175 (nix-eval workflow), #13302 (earlier nixpkgs bump). --- .github/workflows/nix-bun-version-check.yml | 44 +++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/nix-bun-version-check.yml diff --git a/.github/workflows/nix-bun-version-check.yml b/.github/workflows/nix-bun-version-check.yml new file mode 100644 index 00000000000..43815c3745a --- /dev/null +++ b/.github/workflows/nix-bun-version-check.yml @@ -0,0 +1,44 @@ +name: nix-bun-version-check + +on: + pull_request: + branches: [dev] + paths: + - "package.json" + - "flake.lock" + - ".github/workflows/nix-bun-version-check.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + check: + runs-on: blacksmith-4vcpu-ubuntu-2404 + timeout-minutes: 5 + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Setup Nix + uses: nixbuild/nix-quick-install-action@v34 + + - name: Check bun version matches nixpkgs + run: | + set -euo pipefail + + pkg_bun=$(jq -r '.packageManager' package.json | sed 's/bun@//') + nix_bun=$(nix eval --inputs-from . --raw nixpkgs#bun.version) + + echo "package.json: bun@${pkg_bun}" + echo "nixpkgs: bun@${nix_bun}" + + if [ "$pkg_bun" != "$nix_bun" ]; then + 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." + exit 1 + fi + + echo "Versions match."