Skip to content

feat: add Nix flake and Devbox support#3

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

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

Conversation

@levonk

@levonk levonk commented Jul 4, 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:clidey/deptrust
nix profile install github:clidey/deptrust

The flake tracks the default branch and is auto-bumped to the latest release by a daily workflow, so github:clidey/deptrust 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:clidey/deptrust 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.
  • flake.lock: pinned nixpkgs-unstable input.
  • .github/workflows/nix-release.yml: scheduled lag-check automation (daily at 06:17 UTC) 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 installation subsection.
  • .github/workflows/nix.yml: GitHub Actions CI for Nix validation.

Testing

Verified locally:

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

Builds and runs successfully on macOS (Apple Silicon & Intel) and Linux.

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:clidey/deptrust (tracks default branch) or pin to a commit SHA.
  • The nix-release.yml workflow uses a scheduled lag-check (daily at 06:17 UTC) because releases are created with GITHUB_TOKEN, which does not trigger release: published workflows.
  • 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, enabling
one-command install/run via nix run github:clidey/deptrust and
nix profile install github:clidey/deptrust.

- flake.nix: Prebuilt Tarball Flake with per-platform SHA256 hashes
  for x86_64/aarch64 Linux and Darwin
- devbox.json: Go development environment with build/test/run scripts
- .github/workflows/nix-release.yml: scheduled lag-check automation
  that auto-bumps version + hashes when a new release is detected
- .github/workflows/nix.yml: CI validation for flake evaluations
- README.md: Nix and Devbox installation subsections
- .gitignore: Nix build result symlinks
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