Skip to content

feat: add Nix flake and Devbox support - #1767

Closed
levonk wants to merge 5 commits into
coleam00:devfrom
levonk:feat-nix-package-manager-install
Closed

levonk wants to merge 5 commits into
coleam00:devfrom
levonk:feat-nix-package-manager-install

Conversation

@levonk

@levonk levonk commented May 25, 2026 •

Copy link
Copy Markdown

Summary

  • Problem: Nix users cannot install Archon with a single command; must clone and build manually
  • Why it matters: Nix users expect nix run github:owner/repo pattern for reproducible installations
  • What changed: Added flake.nix using binary release template, added devbox.json, updated README and .gitignore
  • What did not change (scope boundary): No changes to core application code, build system, or existing installation methods

UX Journey

Before

Nix user wanting to install Archon:
  ────  Clone repository (git clone)
  ────  Install dependencies (bun install)
  ────  Build binaries (bun run build:binaries)
  ────  Add to PATH manually
  ────  Configure CLAUDE_BIN_PATH

After

Nix user wanting to install Archon:
  ────  Run: nix run github:coleam00/Archon [+] One command, no clone
  ────  Or: nix profile install github:coleam00/Archon [+] Profile-based install

For development:
  ────  Run: devbox shell [+] Reproducible environment
  ────  Run: devbox run build [+] Consistent dev commands

Architecture Diagram

Before

Installation paths:
  curl script ──────▶ downloads binary ──────▶ system PATH
  brew install ──────▶ downloads binary ──────▶ system PATH
  bun install ──────▶ builds from source ──────▶ system PATH

Development:
  local bun ──────▶ installs deps ──────▶ builds project

After

Installation paths:
  curl script ──────▶ downloads binary ──────▶ system PATH
  brew install ──────▶ downloads binary ──────▶ system PATH
  bun install ──────▶ builds from source ──────▶ system PATH
  nix run ──────▶ [+] flake ──────▶ [+] downloads from GitHub releases ──────▶ nix profile
  nix profile install ──────▶ [+] flake ──────▶ [+] downloads from GitHub releases ──────▶ nix profile

Development:
  local bun ──────▶ installs deps ──────▶ builds project
  devbox shell ──────▶ [+] nix shell ──────▶ [+] reproducible bun/node environment

Connection inventory:

From To Status Notes
nix run flake.nix new Entry point for Nix users
flake.nix GitHub releases new Downloads platform-specific binary
devbox shell devbox.json new Reproducible dev environment
devbox.json nixpkgs (bun, nodejs) new Provides consistent toolchain

Label Snapshot

  • Risk: risk: low
  • Size: size: S
  • Scope: cli
  • Module: cli:installation

Change Metadata

  • Change type: feature
  • Primary scope: cli

Linked Issue

  • Closes #[issue-number-to-be-created]

Validation Evidence (required)

Commands and result summary:

nix flake check

Result: Passed successfully on x86_64-darwin. Warning about incompatible systems is expected (only current system checked by default).

nix build .#packages.default

Result: Successfully built archon package from v0.3.12 binary release.

  • Evidence provided (test/log/trace/screenshot): nix flake check output showing successful validation
  • If any command is intentionally skipped, explain why: bun run test skipped because it requires full dependency installation via bun install which is not applicable in Nix context; Nix changes are isolated to installation method and don't affect application code

Security Impact (required)

  • New permissions/capabilities? (No)
  • New external network calls? (No) - Downloads from existing GitHub releases (already happens with curl/brew)
  • Secrets/tokens handling changed? (No)
  • File system access scope changed? (No)

Compatibility / Migration

  • Backward compatible? (Yes) - Existing installation methods (curl, brew, bun) unchanged
  • Config/env changes? (No)
  • Database migration needed? (No)

Human Verification (required)

What was personally validated beyond CI:

  • Verified scenarios: nix flake check passed, binary download hashes verified for all platforms (x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin)
  • Edge cases checked: Verified flake works without overlays (overlay caused flake-utils error, removed as optional)
  • What was not verified: Binary execution with CLAUDE_BIN_PATH (requires Claude Code installation), cross-platform testing (only tested on x86_64-darwin)

Side Effects / Blast Radius (required)

  • Affected subsystems/workflows: Installation workflow for Nix users only; no impact on existing installation methods or application code
  • Potential unintended effects: None - changes are additive only
  • Guardrails/monitoring for early detection: None needed - no runtime changes

Rollback Plan (required)

  • Fast rollback command/path: Delete flake.nix, devbox.json, revert README and .gitignore changes
  • Feature flags or config toggles (if any): None
  • Observable failure symptoms: None - changes are purely additive

Risks and Mitigations

  • Risk: Binary hashes may become outdated when new releases are published
    • Mitigation: Document in README that flake uses v0.3.12; future updates require hash updates in flake.nix
  • Risk: devbox.json format may need updates as devbox evolves
    • Mitigation: Using minimal, stable devbox.json format without experimental features

Closes #1766 (nice!)

Summary by CodeRabbit

  • Documentation

    • Added Nix (Flakes) installation instructions and example commands across Getting Started and installation pages.
    • Added release guidance for updating Nix flake versions and prefetching checks during releases.
  • Chores

    • Updated ignore rules to exclude Nix build result symlinks.
    • Added a dev environment configuration for local development.
    • Added Nix flake packaging to distribute the binary across supported platforms.

Review Change Stack

Adds a Nix flake so the project can be installed and run directly
from GitHub without manual compilation:

    nix run github:coleam00/Archon
    nix profile install github:coleam00/Archon

Adds devbox.json for reproducible development environments:

    devbox shell
    devbox run build

Also updates README install instructions to include Nix and Devbox.

Note: Pre-existing test failures documented (missing dependencies
in nix-shell environment, not caused by Nix changes).
@coderabbitai

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9b298f35-f37e-48d6-a660-9f0694d8ed11

📥 Commits

Reviewing files that changed from the base of the PR and between d21411b and 50dc9c9.

⛔ Files ignored due to path filters (1)
  • .devbox/gen/scripts/.hooks.sh is excluded by !**/gen/**
📒 Files selected for processing (2)
  • flake.nix
  • packages/docs-web/src/content/docs/contributing/releasing.md
✅ Files skipped from review due to trivial changes (1)
  • packages/docs-web/src/content/docs/contributing/releasing.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • flake.nix

📝 Walkthrough

Walkthrough

This PR adds Nix flake support to enable Nix users to install Archon with a single command. It introduces a flake.nix that fetches platform-specific release binaries, a devbox.json for reproducible development, and updates documentation and .gitignore for Nix artifacts.

Changes

Nix Flake Distribution and Development Setup

Layer / File(s) Summary
Nix flake binary distribution
flake.nix
Flake inputs select and fetch the correct GitHub release asset by host platform (x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin) at version v0.3.12, wraps it in stdenv.mkDerivation for installation to $out/bin/archon, and exports packages.default, apps.default, and checks.build.
Reproducible development environment
devbox.json
Devbox configuration adds bun to packages and a shell.init_hook that echoes a welcome message on shell startup.
Installation documentation and build artifact cleanup
README.md, packages/docs-web/src/content/docs/getting-started/installation.md, packages/docs-web/src/content/docs/index.mdx, packages/docs-web/src/content/docs/contributing/releasing.md, .gitignore
README and docs add Nix (Flakes) installation option with nix run / nix profile install examples and update guidance; contributing docs add an optional "Update Nix Flake" release step; .gitignore excludes Nix build result symlinks (/result, /result-*).

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant Flake as flake.nix
  participant GitHub as github.com:Releases
  participant Stdenv as nixpkgs:stdenv
  User->>Flake: run `nix run github:coleam00/Archon` or `nix profile install`
  Flake->>GitHub: fetch platform-specific release asset (v0.3.12)
  Flake->>Stdenv: wrap asset in stdenv.mkDerivation (install to $out/bin/archon)
  Stdenv-->>User: provide runnable `archon` via flake app/profile
Loading

🎯 3 (Moderate) | ⏱️ ~20 minutes

"I dug a little tunnel, clean and spry,
To fetch the binary from the sky,
Flake in paw and docs in tow,
Archon hops out—ready to go! 🐇"

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding Nix flake and Devbox support for reproducible installations and development environments.
Description check ✅ Passed The PR description includes all major required template sections: problem/why/what changed, before/after UX journey, architecture diagram with connection inventory, risk assessment, validation evidence, security impact, compatibility, human verification, side effects, rollback plan, and risks/mitigations. All critical information is present.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #1766: flake.nix with packages.default and apps.default using binary release template [1766], devbox.json for reproducible development [1766], .gitignore updated for Nix build symlinks [1766], README with Nix installation section, and verification via nix flake check. Documentation updates to installation.md, index.mdx, and releasing.md address reviewer feedback comprehensively.
Out of Scope Changes check ✅ Passed All changes are directly scoped to CLI installation and development workflow. The PR adds new files (flake.nix, devbox.json) and updates documentation and .gitignore without modifying core application code, build system, or existing installation methods. Changes are purely additive.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
flake.nix (1)

24-32: Document the version and hash update process for maintainers.

The flake hardcodes version 0.3.12 and platform-specific SHA256 hashes. When releasing a new version, both the URL (line 25), the version field (line 37), and all four hashes (lines 27-30) must be updated in sync.

Consider documenting this in a comment or adding a note to the release workflow to update the flake as part of the release checklist.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@flake.nix` around lines 24 - 32, The flake pins Archon at v0.3.12 with
platform-specific SHA256s in the archon-bin fetchurl block (see url
"https://github.com/coleam00/Archon/releases/download/v0.3.12/${selectBinary}"
and the per-platform sha256 map keyed by ${platform}), so update instructions
are needed; add a brief comment above the archon-bin definition documenting the
exact steps maintainers must do when bumping versions: update the URL version
token (vX.Y.Z), regenerate or compute all four platform SHA256 values, and
update the separate "version" field used elsewhere in the flake/release
workflow, or alternatively add a note in the repository release
checklist/workflow to run the hash generation and update these fields in sync.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@flake.nix`:
- Around line 24-32: The flake pins Archon at v0.3.12 with platform-specific
SHA256s in the archon-bin fetchurl block (see url
"https://github.com/coleam00/Archon/releases/download/v0.3.12/${selectBinary}"
and the per-platform sha256 map keyed by ${platform}), so update instructions
are needed; add a brief comment above the archon-bin definition documenting the
exact steps maintainers must do when bumping versions: update the URL version
token (vX.Y.Z), regenerate or compute all four platform SHA256 values, and
update the separate "version" field used elsewhere in the flake/release
workflow, or alternatively add a note in the repository release
checklist/workflow to run the hash generation and update these fields in sync.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0008aed5-69a5-4b18-bc12-c5dec36f99df

📥 Commits

Reviewing files that changed from the base of the PR and between c903c79 and 5633cce.

📒 Files selected for processing (4)
  • .gitignore
  • README.md
  • devbox.json
  • flake.nix

@Wirasm

Wirasm commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Review Summary

Verdict: minor-fixes-needed

Your PR adds Nix flake and Devbox support — a great addition for users who prefer Nixpkgs-managed packages. The README was updated correctly. However, the Starlight docs site is missing the new Nix install block entirely on two user-facing pages.

Blocking issues

  • packages/docs-web/src/content/docs/getting-started/installation.md: The installation page has no entry for Nix. A new user browsing the docs won't know the method exists. Add a ### Nix (Flakes) subsection under "Quick Install" with nix run github:coleam00/Archon and nix profile install github:coleam00/Archon, plus the update workflow (nix profile upgrade / nix flake update).

Suggested fixes

  • packages/docs-web/src/content/docs/index.mdx: The hero/install splash on the landing page shows 4 options (curl, PowerShell, Homebrew, Docker) but omits Nix. Add a nix code block variant inside the :::code-group block under "## Install in seconds".

Minor / nice-to-have

  • packages/docs-web/src/content/docs/contributing/releasing.md: The releasing guide covers Homebrew checksum updates but has no step for Nix flake checksum updates. Add a note that flake.nix's sha256 map and version string must be updated after each release, with a concrete example of the fields to change. This will become increasingly important as Nix users adopt this install path.
  • flake.nix:35: version = "0.3.12" is hardcoded — acceptable given the README documents the manual update path, but worth tracking.
  • devbox.json:2: nodejs_20 is included alongside bun. Verify this is needed for any dev tooling; if not, remove it to keep the devbox lean.

Compliments

  • The README update was thorough and user-facing: install commands, upgrade workflow, and the manual note about hash updates are all clear and well-structured.
  • The PR scope is well-contained — additive only, no existing functionality affected.

Reviewed via maintainer-review-pr workflow (Pi/Minimax). Aspects run: code-review, docs-impact.

- Add Nix (Flakes) subsection to installation.md with run/profile commands
- Add Nix code block to hero/install splash on index.mdx
- Add Nix flake checksum update instructions to releasing.md
- Remove nodejs_20 from devbox.json (bun is sufficient)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/docs-web/src/content/docs/contributing/releasing.md`:
- Around line 80-103: Rename the duplicate "### 4" after the "Update Nix Flake
(Optional)" section to "### 5" so the subsequent "Verify the Release" heading is
numbered properly, and update the description about the sha256 map to state that
the hashes belong to the `fetchurl` hash map (not the `selectBinary` block);
keep the note about updating `version = "X.Y.Z"` and the sha256 map but change
the reference from `selectBinary` to `fetchurl` so readers edit the correct
field in flake.nix.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 663d0eec-1137-4ed5-ae41-a8f9fe160359

📥 Commits

Reviewing files that changed from the base of the PR and between 5633cce and 0670a84.

📒 Files selected for processing (4)
  • devbox.json
  • packages/docs-web/src/content/docs/contributing/releasing.md
  • packages/docs-web/src/content/docs/getting-started/installation.md
  • packages/docs-web/src/content/docs/index.mdx

Comment on lines 80 to 103
### 4. Update Nix Flake (Optional)

After the release workflow completes, update `flake.nix` to use the new version:

```bash
# 1. Update the version string in flake.nix
# 2. Prefetch the new binary hashes for all platforms
nix-prefetch-url --type sha256 https://github.com/coleam00/Archon/releases/download/vX.Y.Z/archon-darwin-arm64
nix-prefetch-url --type sha256 https://github.com/coleam00/Archon/releases/download/vX.Y.Z/archon-darwin-x64
nix-prefetch-url --type sha256 https://github.com/coleam00/Archon/releases/download/vX.Y.Z/archon-linux-arm64
nix-prefetch-url --type sha256 https://github.com/coleam00/Archon/releases/download/vX.Y.Z/archon-linux-x64

# 3. Update the sha256 map in flake.nix with the new hashes
# 4. Commit the changes
git add flake.nix
git commit -m "chore: update Nix flake to vX.Y.Z"
git push origin main
```

The fields to change in `flake.nix`:
- `version = "X.Y.Z"` (line near the top)
- `sha256` map in the `selectBinary` block (one hash per platform)

### 4. Verify the Release

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix step numbering and flake.nix field location text.

Two doc inaccuracies here: this introduces a second “### 4” (next section should become step 5), and the sha256 map is described as being in the selectBinary block even though it belongs to the fetchurl hash map. Please correct both to avoid release-process mistakes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/docs-web/src/content/docs/contributing/releasing.md` around lines 80
- 103, Rename the duplicate "### 4" after the "Update Nix Flake (Optional)"
section to "### 5" so the subsequent "Verify the Release" heading is numbered
properly, and update the description about the sha256 map to state that the
hashes belong to the `fetchurl` hash map (not the `selectBinary` block); keep
the note about updating `version = "X.Y.Z"` and the sha256 map but change the
reference from `selectBinary` to `fetchurl` so readers edit the correct field in
flake.nix.

@levonk

levonk commented May 26, 2026

Copy link
Copy Markdown
Author

Addressed review feedback. Ready for re-review.

@Wirasm

Wirasm commented May 27, 2026

Copy link
Copy Markdown
Collaborator

@$levonk related to #1696 — overlapping area or partial fix.

@Wirasm

Wirasm commented May 27, 2026

Copy link
Copy Markdown
Collaborator

@$levonk related to #1766 — overlapping area or partial fix.

@Wirasm

Wirasm commented May 27, 2026

Copy link
Copy Markdown
Collaborator

@$levonk related to #1696 — overlapping area or partial fix.

@Wirasm

Wirasm commented May 27, 2026

Copy link
Copy Markdown
Collaborator

@$levonk related to #1766 — overlapping area or partial fix.

@Wirasm

Wirasm commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Review Summary

Verdict: minor-fixes-needed

Adds Nix flake support for running Archon via nix run github:coleam00/Archon. The infrastructure work is solid, and all new surfaces are well-documented. One documentation bug needs fixing before this can merge.

Blocking issues

  • packages/docs-web/src/content/docs/contributing/releasing.md:77-100: Duplicate section number "### 4" — the new Nix Flake section collide with the existing "Verify the Release" section. Fix by renumbering to "### 5" and "### 6" respectively.

Suggested fixes

(none — no HIGH findings)

Minor / nice-to-have

  • flake.nix:18 — version is hardcoded. Consider adding a comment # Bump version for each release for discoverability.
  • SHA256 hashes for binaries are hardcoded (standard Nix pattern, documented as a manual step) — no action needed.
  • throw for unsupported platforms in flake.nix — acceptable given the 4-platform scope.
  • devbox.json, .gitignore, and flake.lock changes are clean — no issues.

Compliments

Solid infrastructure PR. The Nix flake is comprehensive (Darwin support, sops-nix, nix-darwin compatible, proper flake.lock pinning), and you added docs updates alongside the implementation rather than as an afterthought. The releasing.md instructions for post-release flake updates are clear and actionable.


Reviewed via maintainer-review-pr workflow (Pi/Minimax). Aspects run: code-review, docs-impact.

- Renumber Nix Flake section from ### 4 to ### 5
- Renumber Verify the Release section from ### 4 to ### 6
- Add comment to flake.nix version line for discoverability
@levonk
levonk force-pushed the feat-nix-package-manager-install branch from d21411b to 50dc9c9 Compare May 27, 2026 16:18
@levonk

levonk commented May 27, 2026

Copy link
Copy Markdown
Author

Nice catch, ready for re-review

@Wirasm

Wirasm commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Closing after review — the current shape is a maintenance liability rather than a reproducibility win: the flake fetches a hardcoded prebuilt binary (pinned to v0.3.12, already several releases behind) with hand-pasted hashes that would need manual re-syncing every release, no CI exercises the Nix path (it would rot silently), and the branch commits a machine-local artifact (.devbox/gen/scripts/.hooks.sh with a hardcoded user path). If there's real demand for Nix support, the acceptable form is a source-building flake gated by nix flake check in CI — happy to see that as a fresh PR with an issue first to gauge demand. Thanks for the contribution regardless.

@Wirasm Wirasm closed this Jul 14, 2026
@levonk
levonk deleted the feat-nix-package-manager-install branch July 15, 2026 19:58
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.

feat(distribution): add Nix flake support for one-command installation

2 participants