feat: add Nix flake support - #1784
Conversation
PR Review SummarySize
Affected cratesNo crate source directories are directly affected. Blast radius — ModerateThis PR touches: documentation,CI / build tooling Updated automatically on each push to this PR. |
Add flake.nix exposing prebuilt binaries (default), from-source build (#source), and devShell. Prebuilt tarballs from v0.71.0 release for all 4 platforms (x86_64/aarch64 linux/darwin). Source build uses rustPlatform.buildRustPackage with cargoHash tracked from nixpkgs. x86_64-darwin pinned to nixpkgs-24.05-darwin for Intel macOS compat. Install: nix run github:levonk/nono nix profile add github:levonk/nono nix run github:levonk/nono#source # from-source build Signed-off-by: levonk <277861+levonk@users.noreply.github.com>
….75.0 nixpkgs-24.05-darwin has been EOL'd and no longer resolves. Bump to nixpkgs-26.05-darwin which ships Rust 1.95 (edition2024) required by the project. Update release hashes for v0.75.0. Signed-off-by: levonk <277861+levonk@users.noreply.github.com>
Add a 3-runner matrix (ubuntu-latest, macos-13, macos-14) to the Nix CI workflow so darwin hash mismatches and build failures are caught in CI, not just by users. nix flake check --all-systems --no-build evaluates darwin outputs without realising fetchurl derivations, so a hash mismatch on darwin is invisible without building on darwin. Also switch the trigger from release:published to pull_request with path filters (including Cargo.lock for the #source FOD), and bump timeout-minutes from 20 to 30 for macOS source builds. Add CHANGELOG entry under [Unreleased] -> Features. Signed-off-by: levonk <277861+levonk@users.noreply.github.com>
0b75a42 to
3660a04
Compare
SequeI
left a comment
There was a problem hiding this comment.
This feels overbuilt for what we need, and CI is broken right now.
CI: Action Lint is failing because nix.yml:52 uses runs-on: macos-13, which isn't a valid runner label anymore. That's also why the Nix flake workflow's macos-13 job has been stuck queued for over an hour. Just swap to macos-14 or macos-15.
Bugs:
nix-release.yml's bump script updates the prebuilt binary hashes but never touchessourceFor's hash/cargoHash in flake.nix. After a version bump,nix build .#sourcebreaks.- The
.#sourcebuild step innix.ymlhas nopull_requestguard like the nix run step does, so once the above breaks, it'll fail on every unrelated PR. IGNORED = (..., "pnpr-", ...)looks like a leftover from a pnpm workflow this was copied from. Doesn't match anything real, just dead code.
main had zero Nix support before this, so we don't need to be this complex. The prebuilt binary table plus bump script is solving a problem we don't have. Nix's whole point is reproducible source builds. I'd rather just have one flake.nix with a single buildRustPackage derivation (version pulled from Cargo.toml so nothing needs syncing), and one CI job checking nix flake check + nix build on Linux and macOS. Drop nix-release.yml entirely.
For installing a specific version: nix run github:nolabs-ai/nono?ref=v0.75.0. For latest, just document a curl-the-github-api-then-nix-run one-liner, same pattern as our existing install docs.
I'm also going to submit nono to nixpkgs directly and become its maintainer there. Once that's in, nixpkgs' own update bot handles version bumps automatically, so people can just install from nixpkgs/NixOS too. Separate issue, not blocking this one.
Last thing: the comments in nix-release.yml are way too long. Keep them to one line where the reasoning isn't obvious.
Can pair on rewriting this if helpful, will do so on Monday as this is something we do want to get in. Thanks for the PR!
What
Adds a
flake.nixso the project can be installed and run directly from GitHub at the latest release:The flake tracks the default branch and is auto-bumped to the latest release by a daily workflow, so
github:nolabs-ai/nonoalways serves the current release.Why
Enables
nix run github:nolabs-ai/nonoandnix profile add github:nolabs-ai/nonofor users who already have Nix installed. The flake wraps the prebuilt release binary directly (no nixpkgs build toolchain in the path) and includes a from-source build option for reproducibility/auditability.Relationship to nixpkgs
This project is already in nixpkgs as
nixpkgs#nono(currently0.61.1on unstable; latest release is0.75.0). This flake is complementary, not redundant:#prebuiltserves the official release artifact directly — no nixpkgs build toolchain in the path;#sourcebuilds from source for auditability. Both are exercised by CI.x86_64-darwinat the latest version — nixpkgs'smeta.platformsdeclaresx86_64-darwinbut the stable darwin channel ships an older version; the flake'snixpkgs-darwin-legacypin builds it at the latest release, where the nixpkgs darwin stable channel ships0.61.1.nix profile add nixpkgs#nonostill works and this flake does not replace it.Changes
flake.nix: Nix flake wrapping the prebuilt release tarball aspackages.<system>.defaultandapps.<system>.default.flake.lock: pinnednixpkgs-unstableinput..github/workflows/nix-release.yml: scheduled lag-check automation that auto-bumpsversion+ per-platformsha256hashes and opens a PR whenflake.nixfalls behind the latest release..github/workflows/nix.yml: GitHub Actions CI for Nix validation with cross-platform matrix (ubuntu-latest, macos-13, macos-14)..gitignore: Added Nix build result symlinksREADME.md: Added Nix installation subsectionCHANGELOG.md: Added changelog entryTesting
Verified locally:
Builds and runs successfully on
aarch64-darwin.Notes
#prebuilt(also#default, fast, no compilation) and a from-source build as#source(reproducible, auditable). Both are exercised by CI.github:.../vX.Y.Z) is not supported for the prebuilt output — release tags are cut before the bump workflow updatesflake.nix. Usegithub:.../(tracks default branch) or pin to a commit SHA. The#sourceoutput works at any tag since it builds from source.Scope
The PR scope is well-contained — additive only, no existing functionality affected.
Related
Resolves #1783