Conversation
There was a problem hiding this comment.
Pull request overview
Adds Nix flake support for reproducible builds/dev (via flake-parts + crane), enabling nix run, nix build, and nix develop workflows alongside existing Rust tooling.
Changes:
- Introduces
flake.nix/flake.lockto package and develophelix-trainerwith Nix (including clippy/fmt checks and a dev shell). - Documents Nix installation and integration in
README.md. - Updates contributor quick-start and ignores Nix build output symlink.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| flake.nix | Defines flake inputs/outputs, crane-based Rust build, checks, and dev shell. |
| flake.lock | Pins nixpkgs/crane/flake-parts/rust-overlay/helix sources for reproducibility. |
| README.md | Adds Nix usage docs (nix run + NixOS/home-manager integration snippet). |
| CONTRIBUTING.md | Adds nix develop to quick start for contributor onboarding. |
| .gitignore | Ignores the Nix result output symlink. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| # configuration.nix or home.nix | ||
| environment.systemPackages = [ inputs.helix-trainer.packages.${system}.default ]; |
There was a problem hiding this comment.
The home-manager example uses environment.systemPackages, which is a NixOS option and won’t work in home.nix. Also ${system} isn’t defined in typical module configs; use ${pkgs.system} (or pkgs.system) and show the correct option for home-manager (e.g., home.packages).
| # configuration.nix or home.nix | |
| environment.systemPackages = [ inputs.helix-trainer.packages.${system}.default ]; | |
| # configuration.nix (NixOS) | |
| environment.systemPackages = [ inputs.helix-trainer.packages.${pkgs.system}.default ]; | |
| # home.nix (home-manager) | |
| home.packages = [ inputs.helix-trainer.packages.${pkgs.system}.default ]; |
| clippy = craneLib.cargoClippy (commonArgs | ||
| // { | ||
| inherit cargoArtifacts; | ||
| cargoClippyExtraArgs = "--all-targets -- --deny warnings"; |
There was a problem hiding this comment.
The Nix clippy check doesn’t enable all Cargo features (--all-features), so it can miss warnings that CI currently catches. Align this with the repository’s clippy invocation used in CI to avoid drift.
| cargoClippyExtraArgs = "--all-targets -- --deny warnings"; | |
| cargoClippyExtraArgs = "--all-features --all-targets -- --deny warnings"; |
|
|
||
| # Patch the vendored deps to include languages.toml that | ||
| # helix-loader expects via include_bytes!("../../languages.toml") | ||
| vendorDir = craneLib.vendorCargoDeps {src = ./.;}; |
There was a problem hiding this comment.
vendorCargoDeps is using src = ./.; (unfiltered), which will make Nix rebuild vendored deps when unrelated working-tree artifacts appear/change (notably the result symlink that this PR now ignores in git). Consider reusing the same filtered src you define below (or a cleanSource helper) so builds are stable and don’t depend on local artifacts.
| vendorDir = craneLib.vendorCargoDeps {src = ./.;}; | |
| vendorDir = craneLib.vendorCargoDeps { src = src; }; |
| # Enter the dev shell (provides Rust 1.89, cargo-watch, cargo-deny, and native deps) | ||
| nix develop | ||
|
|
There was a problem hiding this comment.
The quick start now suggests nix develop provides the dev tooling, but later steps require cargo +nightly fmt (rustup toolchain selector). The Nix dev shell currently pins a stable toolchain, so contributors following these instructions inside nix develop may be unable to run the formatting step. Either include a nightly toolchain/rustfmt in the dev shell or adjust the docs for Nix users.
Description
Add a Nix flake using flake-parts and crane for reproducible builds and development. This allows helix-trainer to be installed on NixOS, developed with Nix (the package manager), and run without installation via
nix run.Type of Change
Related Issues
None
Changes Made
Testing
All existing tests pass, and all functionality remains the same. Entered the development environment with
nix develop, built the program withnix build, and ran the program withnix run.Test Results
cargo nextest run --lib)# Test commands run cargo nextest run --lib cargo clippy -- -D warnings cargo +nightly fmt -- --check cargo deny checkTest Coverage
No additional tests added
Screenshots/Demo
Checklist
Performance Impact
Security Considerations
Additional Notes
Additional maintenance realistically not needed - however, I am happy to help when needed!