Skip to content

feat: add Nix flake and Devbox support#3

Open
levonk wants to merge 1 commit into
modiqo:mainfrom
levonk:feat-nix-package-manager-install
Open

feat: add Nix flake and Devbox support#3
levonk wants to merge 1 commit into
modiqo:mainfrom
levonk:feat-nix-package-manager-install

Conversation

@levonk

@levonk levonk commented Jul 7, 2026

Copy link
Copy Markdown

What

Adds a flake.nix so the project can be installed and run directly from GitHub at the latest release:

nix run github:modiqo/cliare
nix profile install github:modiqo/cliare

The flake tracks the default branch and is auto-bumped to the latest release by a daily workflow, so github:modiqo/cliare always serves the current release.

Adds a devbox.json for reproducible development environments:

devbox shell
devbox run build

Why

For users who already have Nix installed, a flake provides:

  • One-command install / runnix run github:modiqo/cliare with no clone or manual build steps.
  • Pure / Hermetic builds — every input (the prebuilt binary, glibc/libiconv) is pinned in flake.lock. If it builds today, it builds in ten years.
  • Reproducible — the exact same derivation always produces the exact same output bit-for-bit. No "works on my machine."
  • Idempotent installs — running nix profile install twice is a no-op.
  • Rollback-ablenix profile rollback restores the previous profile generation instantly.
  • Cross-platform — same invocation on macOS (Apple Silicon & Intel) and Linux. The flake handles platform-specific linking.
  • Atomic upgrades / downgrades — profiles are switched atomically. No half-upgraded state.
  • Clean uninstallnix profile remove leaves no residue.

Changes

  • flake.nix: Nix flake wrapping the prebuilt release tarball as packages.<system>.default and apps.<system>.default, plus the named cliare output for both.
  • flake.lock: pinned nixpkgs-unstable input.
  • .github/workflows/nix-release.yml: scheduled lag-check automation that auto-bumps version + per-platform sha256 hashes and opens a PR when flake.nix falls behind the latest release.
  • devbox.json: Devbox configuration for reproducible development environments.
  • .gitignore: Added Nix build result symlinks.
  • README.md: Added Nix and Devbox installation subsections.
  • CHANGELOG.md: Added Unreleased changelog entry.

Testing

Verified locally:

nix flake check --no-build
nix build .
nix run . -- --help
nix run .#cliare -- --help

Builds and runs successfully on aarch64-darwin.

Notes

  • The flake wraps the prebuilt release tarball rather than building from source, so it stays in sync with releases and avoids a full toolchain in the closure.
  • Tag-pinning (github:.../vX.Y.Z) is not supported — release tags are cut before the bump workflow updates flake.nix. Use github:.../ (tracks default branch) or pin to a commit SHA.
  • The bump workflow uses the scheduled lag-check variant (Template A) because releases are created with GITHUB_TOKEN, which does not start new workflow runs; a release: published trigger would silently never fire.
  • No breaking changes to existing build paths.

Scope

The PR scope is well-contained — additive only, no existing functionality affected.

Related

Resolves #2

Add a Nix flake that wraps the prebuilt release tarball so cliare can be
installed and run directly from GitHub with Nix, plus a Devbox environment
for reproducible development.

- flake.nix: packages.cliare and apps.cliare (plus default) for
  x86_64/aarch64 linux and darwin, wrapping the prebuilt release binary
  with autoPatchelfHook on Linux.
- .github/workflows/nix-release.yml: scheduled daily lag-check that
  auto-bumps the pinned version and per-platform SRI hashes and opens a
  PR when flake.nix falls behind the latest release. Uses the scheduled
  variant because releases are created with GITHUB_TOKEN, which does not
  start new workflow runs.
- devbox.json: rustc, cargo, rust-analyzer with build/test/check scripts.
- .gitignore: ignore Nix build result symlinks.
- README.md: add Nix and Devbox install subsections.
- CHANGELOG.md: add Unreleased entry.
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: add Nix flake support for one-command installation

1 participant