Add Nix flake for installation via nix run/profile install#2260
Conversation
Exposes the latest prebuilt release tarball as `packages.<system>.default` and `apps.<system>.default` for x86_64/aarch64 linux and darwin, so users can `nix run github:j178/prek` for the current release instead of waiting for nixpkgs (currently lagging at 0.3.11). README Nix section updated with flake instructions alongside the existing nixpkgs path. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2260 +/- ##
=======================================
Coverage 93.00% 93.00%
=======================================
Files 127 127
Lines 27674 27674
=======================================
+ Hits 25738 25739 +1
+ Misses 1936 1935 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 458668bbf5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| nix profile install github:j178/prek | ||
|
|
||
| # Pin a specific release | ||
| nix run github:j178/prek/v0.4.5 |
There was a problem hiding this comment.
Pin to a ref that contains the flake
Per the Nix manual, github:<owner>/<repo>/<rev-or-ref> selects that tag/branch and a flake must be a tree with a root flake.nix; the current v0.4.5 tag predates this commit and does not contain flake.nix, so users following this pin example will get a “does not appear to be a flake” error instead of a pinned install. Please use a release tag that actually includes the flake, or pin to a commit/branch that has this file.
Useful? React with 👍 / 👎.
What
Adds a
flake.nixso prek can be installed and run directly from GitHub at the latest release:nix run github:j178/prek nix profile install github:j178/prek nix run github:j178/prek/v0.4.5 # pin a specific releaseWhy
prek is already packaged in nixpkgs, but the nixpkgs unstable channel lags behind upstream releases (currently shipping 0.3.11 vs the latest 0.4.5). A flake in this repo gives users the current release directly from GitHub without waiting for nixpkgs to catch up, and provides:
nix run github:j178/prekwith no clone or manual build steps.flake.lock. If it builds today, it builds in ten years.nix profile installtwice is a no-op.nix profile rollbackrestores the previous profile generation instantly.nix profile removeleaves no residue.Changes
flake.nix: Nix flake wrapping the v0.4.5 prebuilt release tarball aspackages.<system>.defaultandapps.<system>.defaultfor x86_64/aarch64 linux+darwin. UsesautoPatchelfHookon Linux for glibc linking.flake.lock: pinnednixpkgs-unstableinput..gitignore: added/resultand/result-*Nix build symlinks.README.md: extended the existing Nix install section (<!-- --8<-- [start: nix-install] -->) with flake-based install/run commands alongside the existing nixpkgs path.docs/installation.mdpicks this up automatically via its--8<-- "README.md:nix-install"include.Testing
Verified locally on
x86_64-darwin:No source files in
crates/are touched — the diff isflake.nix,flake.lock,.gitignore, and a README snippet, so the existing test suite is unaffected.mise run lintwas not run locally (mise / the 1.96 toolchain aren't installed on the contributor's machine); since no.rsfiles are touched,cargo fmt/cargo clippycan't flag anything in this diff. Happy to run it if the maintainer prefers, otherwise upstream CI will cover it.Notes
cargo-distreleases and avoids a full Rust toolchain in the closure.x86_64-linux,aarch64-linux,x86_64-darwin,aarch64-darwin). Upstream also ships musl/arm/armv7/riscv64/s390x tarballs, but those map to no stdenv system. Aponytail:comment inflake.nixdocuments the upgrade path.versionand refresh the 4 SRI hashes inflake.nix(prefetch withnix-prefetch-url --type sha256 <asset-url>).nixpkgs-unstablefor broad platform support. Darwin builds uselibiconvonly; modernstdenvhandles Security framework linking without the deprecatedapple_sdkcompatibility stub.Scope
The PR scope is well-contained — additive only, no existing functionality affected.
Related
Closes: #2259