# Naersk

A Nix library that builds Rust projects into Nix derivations directly from Cargo.lock, without extra configuration, code generation or import-from-derivation.

Naersk exposes a buildPackage function that turns a Rust project's source directory into a Nix derivation: it parses Cargo.lock, downloads the project's dependencies and compiles the application, taking advantage of Nix's sandboxing and caching. Because all of this parsing happens directly in Nix code rather than through import-from-derivation, Naersk also works with Hydra-based continuous integration.

It can be set up either through Nix flakes, where a flake.nix file next to Cargo.toml calls buildPackage, or through Niv, where a generated default.nix calls the packaged function instead. By default Naersk ignores any rust-toolchain file in a project and uses whichever Rust compiler version is available in nixpkgs, though a project's own toolchain file can be honored instead when that behavior is explicitly configured.

It is released under the MIT license.

Website: https://github.com/nix-community/naersk
