Skip to content

Nix flake packaging: nix run github:rtk-ai/icm#320

Open
Donach wants to merge 1 commit into
rtk-ai:mainfrom
Donach:flake-packaging
Open

Nix flake packaging: nix run github:rtk-ai/icm#320
Donach wants to merge 1 commit into
rtk-ai:mainfrom
Donach:flake-packaging

Conversation

@Donach

@Donach Donach commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Adds a flake.nix so Nix/NixOS users can build, run, and install icm straight from the repo:

nix run github:rtk-ai/icm
nix profile install github:rtk-ai/icm

No impact on cargo users — the binary is a stock default-features build (rusqlite backend, embeddings, tui), just packaged.

Design

  • Zero-maintenance: cargoLock.lockFile vendors dependencies straight from the committed Cargo.lock, so there's no cargoHash to bump on dependency updates. Release-please version bumps only touch the one version field.
  • Sandbox-correct native deps: OPENSSL_NO_VENDOR=1 links the nixpkgs openssl, and ORT_STRATEGY=system points fastembed/ort at the nixpkgs onnxruntime (prebuilt downloads don't work inside the Nix build sandbox).
  • Dev shell: nix develop gives the Rust toolchain + pkg-config/openssl/onnxruntime for hacking on the repo without global installs.
  • Linux only for now (x86_64-linux, aarch64-linux) since that's what I can verify; darwin most likely works (onnxruntime/openssl exist there) and is a one-line addition if someone can confirm.

Verified: nix build ✅, nix flake check ✅, nix run . -- --versionicm 0.10.57 ✅.

CI could later gain a nix build job, but I've kept this PR minimal on purpose.

Stacking note

This is the base of a small stack: #262 (opt-in libSQL/Turso backend) will be rebased on top and extend the flake with a turso-featured package output. If you'd rather not take the flake at all, #262 works without it — happy to reshuffle either way.

Adds a flake.nix so Nix/NixOS users can build, run, and install icm
directly from the repo:

  nix run github:rtk-ai/icm
  nix profile install github:rtk-ai/icm

Design notes:
- cargoLock.lockFile vendors deps straight from the committed Cargo.lock,
  so there is no cargoHash to bump on dependency updates — the flake is
  zero-maintenance for day-to-day development.
- OPENSSL_NO_VENDOR + ORT_STRATEGY=system link the nixpkgs openssl and
  onnxruntime (fastembed/ort cannot download prebuilts in the Nix sandbox).
- Default features (rusqlite backend, embeddings, tui) — the binary is
  identical in behaviour to a stock cargo build.
- devShells.default provides the Rust toolchain + native deps for hacking.
- Linux systems only for now (x86_64/aarch64); darwin likely works but is
  unverified, trivially addable.

No impact on cargo users; .gitignore gains the nix 'result' symlink.
@Donach
Donach force-pushed the flake-packaging branch from 739ede2 to a4b4f01 Compare July 10, 2026 12:01
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.

2 participants