build: package the kitchen CLI as a Nix flake #1
Reference in New Issue
Block a user
Delete Branch "task-0001-flake-build"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Spec
nix-flake-packaging, ADR 0007.Summary
The tracer-bullet build slice: a flake-parts flake whose default package Bun-compiles the
kitchenCLI into a self-contained native binary, built in the sandbox with dependencies vendored by bun2nix.[ "x86_64-linux" ],nixpkgstrackingnixpkgs-unstable.nixpkgs-buninput (Bun 1.3.13) that bun2nix follows — bun2nix bakes its own nixpkgs' Bun into the compile hook, so the pin lives where that follow points, and updatingnixpkgscannot drag Bun onto a release that emits empty binaries.postinstall: bun2nix -o bun.nixhook keeping the checked-inbun.nixin sync with the lockfile. The build setsdontRunLifecycleScripts = trueso that hook does not fire redundantly in the sandbox.Verified against a real
nix build: a 101 MB native ELF that runs to exit 0 underenv -i(no Node or Bun,lddshows only glibc), the compile derivation is sandboxed with no network, and a throwaway consumer flake built the package asinputs.kitchen.packages.x86_64-linux.default.Deviations
nixConfigblock that the bun2nix templates ship, because the spec lists "any binary cache or substituter setup" as out of scope. A first build with a cold store therefore compiles bun2nix from source; a developer who wants the prebuilt bun2nix can add the substituter to their own Nix configuration.packages/bin/src/index.tsremains the placeholder entry point — CLI behaviour belongs to the core-parser and cli-view specs, so the compiled binary is a no-op that exits 0, enough to prove the packaging seam.Review
Risk
Overall: LOW
nix buildsucceeds (verified).No unaddressed Standards or Spec findings — the two comment-style breaches, the speculative
_module.args.pkgs, the duplicated version, and the out-of-scope cachix block were all fixed in this diff.Added: flake app, dev shell, direnv, and checks
Spec
nix-flake-packaging, ADR 0007. Added as a second commit by request.What was built
nix run—apps.defaultpoints at the compiled binary.nix develop— dev shell exposes the pinned Bun 1.3.13, biome 2.5.4, and bun2nix (the last so the repo'spostinstallregeneration ofbun.nixworks in-shell).inputs.nixpkgs-bundirectly and the build takes it through bun2nix'sfollowson the same input, so both resolve to the one pinned Bun.use flake.envrc;.direnv/gitignored.nix flake check— aggregatestests(Bun test tiers, 55 tests),smoke(runs the Nix-built binary--help, asserts zero exit), and biome lint via the treefmt-nix flake-parts module. All three green.Verified end-to-end:
nix runexits 0,nix developreports the expected tool versions,nix flake check→all checks passed!.Deviations
packages/core/src/index_test.tsreformatted by biome. Twotest.todolines exceeded the repo'slineWidth; the new lint gate can only be green if the tree conforms to its ownbiome.json. Formatting-only, no behaviour change.biome.json(viaimportJSON) withvcs.enabledoverridden off, because the reproducible check has no git tree for biome's ignore-file lookup, and treefmt already selects the files. Schema validation is skipped (nixpkgs biome is newer than treefmt-nix's bundled schema; the config is the one biome itself runs with).Review
Risk
Overall: MEDIUM
nix flake check(run green), not by unit tests.No unaddressed Standards or Spec findings. The four comment-style standards nits (two comments narrating treefmt-nix, one justifying against an alternative, and an over-claiming "never diverge" on the Bun pin) were all reworked in this diff. The spec review found all five acceptance criteria met,
apps.defaultcorrectly satisfying thenix runrequirement; the vacuous smoke check and manual version verification are expected while the CLI is a placeholder, per the spec's "assert a zero exit".135ec392fftofdede89e0cbuild: package the kitchen CLI as a Nix flake (task 0001)to build: package the kitchen CLI as a Nix flake