2.2x (compared to CppNix) faster nar encode/decode written in Rust.
Disclaimer: LLMs have been used
2.2x (compared to CppNix) faster nar encode/decode written in Rust.
Disclaimer: LLMs have been used
Is this project LLM assisted?
Si señor, that’s why it exists ![]()
@domenkozar, why are you comparing against RemoteStore::narFromPath instead of SourceAccessor::dumpPath or LocalFSStore::narFromPath (which also doesn’t go through the daemon).
Though I guess it’s nice to have one more slop RIIR in addition to harmonia ![]()
Because most of Nix usage in the wild will go through the daemon. I wish it wasn’t that way ![]()
I made it a separate project so that it can be shared as a library.
By number of tests and benchmarks it’s less slop than implementions out there, unless you mean only it’s LLM written.
Yeah sorry, I might have come off a bit offensive there; I’m just frustrated I that I think foundational improvements also are a great fit for upstream nix too and trying to make that happen
. It makes me sad that we are in the state when upstream nix is too painful to integrate that we have to resort to reinventing the wheel again and again.
FWIW, the nix cli doesn’t go through the daemon for reading store NARs.
No worries
I share that frustration and I’m not sure there’s an ideal solution.
I need core Nix functionality to be written in Rust, I hope by making a library independent we can achieve more reuse long-term.
Could we get cppnix to start using Rust libraries (again)?
Good point, is there C FFI I can also benchmark against?
@domenkozar Would you be willing to add a small CLI to the crate? Something like nix-archive {pack,unpack} $narfile $directory which mimics nix nar pack and nix-store --restore?
If you believe it fits the scope of the project I could open a PR later this week.
Hell yeah! Submit a PR, LLMs welcome.
nix-archive 0.2.0 adds:
NarHash, a named type containing NAR size and SHA-256 digest.Breaking API changes:
NarHash instead of (u64, [u8; 32]).Entry::Symlink now borrows its target as &[u8].Entry::path() now returns &Path.NAR Error enum is now non-exhaustive.You are fast
I implemented a CLI yesterday, everything seems to be quite similar. There are some small things that you might consider in your version. For reference, you can find my code here: GitHub - fgrsnau/nix-archive at cli · GitHub
Biggest quality of life change difference:
I am happy to have a simple library and tool for nar file manipulation. Thanks for your work in this space.