Skip to content

build(nix): add Nix flake for reproducible builds and dev shell#85

Open
nilp0inter wants to merge 1 commit into
onllm-dev:mainfrom
nilp0inter:main
Open

build(nix): add Nix flake for reproducible builds and dev shell#85
nilp0inter wants to merge 1 commit into
onllm-dev:mainfrom
nilp0inter:main

Conversation

@nilp0inter

Copy link
Copy Markdown

Add flake.nix exposing:

  • packages.onwatch: static pure-Go binary via buildGoModule (tracks nixos-unstable)
  • devShell: go 1.26.4, gopls, gotools, gofumpt
  • apps.default: enables nix run .#onwatch

Includes:

  • .envrc for direnv integration
  • .gitignore updates for result/
  • Nix documentation in README.md and CLAUDE.md

Why nixos-unstable? The go.mod requires Go >= 1.25.7, but nixos-25.05 only ships Go 1.24 (and go_1_25 = 1.25.5). The flake tracks nixos-unstable which defaults to Go 1.26.x, satisfying the requirement while providing a reproducible, pinned toolchain.

vendorHash: Pinned from go.sum (sha256-zagPclPZItTTUaMh+8Ph7k5ESqc3vETPNkhMQ493MoY=). On go.sum changes, update this hash by running nix build .#onwatch and pasting the got: sha256-... value from the mismatch error.

Usage:

nix build .#onwatch      # Build -> ./result/bin/onwatch
nix run .#onwatch         # Build + run
nix develop               # Enter dev shell (or `direnv allow`)

See the "Nix" section in README.md for details.

Add flake.nix exposing:
- packages.onwatch: static pure-Go binary via buildGoModule (nixos-unstable)
- devShell: go 1.26.4, gopls, gotools, gofumpt
- apps.default for nix run

Includes .envrc for direnv integration, updated .gitignore for result/,
and Nix documentation in README.md and CLAUDE.md.

Flake tracks nixos-unstable because go.mod requires Go >= 1.25.7
(nixos-25.05 only ships Go 1.24). VendorHash is pinned from go.sum.
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