Skip to content

build: develop in a nix shell, and lint each commit - #3

Merged
aripiprazole merged 1 commit into
mainfrom
build/nix
Oct 14, 2026
Merged

aripiprazole merged 1 commit into
mainfrom
build/nix

Conversation

@aripiprazole

Copy link
Copy Markdown
Collaborator

Purpose

Running bun run check needs exact tool versions. With Bun 1.3.13, the frozen install fails and 10 tests fail. This PR gives everyone the same tools, and lints each commit before it reaches CI.

  • flake.nix: nix develop (or direnv allow once, via .envrc) gives a shell with Bun 1.4.2, Node 24 and Python 3.
    • Everything comes from stable nixos-26.05 except Bun. Stable ships Bun 1.3.13 and the project pins 1.4.2, so Bun alone comes from nixos-unstable.
  • Pre-commit hook: entering the shell installs it, through git-hooks.nix. It runs Biome and nixfmt.
    • It uses the project's own Biome (node_modules/.bin/biome), so it always formats like CI does. Nix's Biome (2.4.15) is a different version from the project's 2.4.16.
    • It fixes what it can and fails the commit if anything changed.
    • It doesn't run ESLint or tsc, which are slow. bun run check still runs them in CI.
  • .zed/settings.json:
    • Biome formats on save and organizes imports. Zed takes Biome from node_modules, so it uses the pinned version.
    • nil and nixfmt for Nix files run from the shell through direnv exec.
  • CI: bun pm pack --dry-run replaces npm pack --dry-run.
  • .direnv/ and the generated .pre-commit-config.yaml are gitignored. Without that, Biome follows the config link and fails to parse it.

Verification

All run inside nix develop:

  • bun install --frozen-lockfile and bun run check pass, including all 121 tests and the build.
  • bun pm pack --dry-run lists 20 files.
  • pre-commit run --all-files passes Biome and nixfmt.
  • On a staged, badly formatted .ts file, the hook rewrites it and fails the commit.

flake.nix gives the shell Bun 1.4.2, Node 24 and Python 3, from
nixos-26.05 but for Bun: stable has 1.3.13, so Bun comes from unstable.
Entering the shell installs a pre-commit hook that runs the project's
own Biome, the version CI checks with, and nixfmt. .zed/settings.json
formats with Biome on save, and runs nil and nixfmt from the shell.
CI packs with bun pm pack in place of npm pack.
@aripiprazole
aripiprazole added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 801a255 Oct 14, 2026
2 checks passed
@aripiprazole
aripiprazole deleted the build/nix branch October 14, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant