feat: Add Nix flake for reproducible builds#94
Conversation
- Add flake.nix with naersk-based Rust build configuration - Add flake.lock for reproducible Nix dependencies This enables `nix develop` for development shell and `nix build` for building the project.
- Add `nix run github:bartolli/codanna` to Quick Start section - Lists as fourth installation option alongside curl, Homebrew, Windows
|
Hi, thanks for adding Nix flake support. Before merging, there are a few things worth addressing. The flake.lock currently pins three separate nixpkgs revisions because naersk (via fenix) and rust-overlay each bring their own. Using inputs.nixpkgs.follows = "nixpkgs" on those inputs would deduplicate them and reduce the closure size significantly. The hardcoded version = "0.9.17" in flake.nix will drift on every release -- naersk reads the version from Cargo.toml automatically, so that line can just be removed. The devShell should also set ORT_SKIP_DOWNLOAD = "1" as an env var (like the package build does), otherwise cargo build inside nix develop will try to download its own ONNX Runtime instead of using the Nix-provided one. One thing I'd like to confirm, have you run nix build to completion? The project pins ort = "=2.0.0-rc.10" (ONNX Runtime 1.22) due to glibc constraints, and the nixpkgs onnxruntime package may be a different version. If the C API doesn't match, the build will compile but fail at runtime. Also, result (the symlink nix build creates) should be added to .gitignore. These should all be quick fixes. I'm not a Nix user myself, otherwise I'd have patched them directly. Thanks again for the contribution! |
- Deduplicate nixpkgs using inputs.follows (3→1 revision) - Remove hardcoded version (naersk reads from Cargo.toml) - Add ORT_SKIP_DOWNLOAD=1 to devShell - Add result symlinks to .gitignore
yes. it was built and works. |
Summary
Changes
Commits
ef90ea8- Add flake.nix with naersk-based Rust build configuration5c59244- Add Nix installation option to READMEc464195- Fix nix devshell environmentDetails
flake.nix
ORT_SKIP_DOWNLOAD=1to use pre-installed ONNX RuntimeREADME.md
nix run github:bartolli/codannaas fourth installation optionWhy Nix Flakes?
Nix flakes provide:
nix runornix developgets you started instantlyThis enables users to run codanna without installing Rust or managing dependencies manually.