Naersk is a Nix library that automates building Rust projects by parsing `Cargo.lock` and creating Nix derivations for dependencies and the final binary. It leverages Nix's sandboxing and caching to achieve reproducible and incremental builds. The library exposes a single entry point, `buildPackage`, which accepts a source directory (or attribute set) and returns a derivation. Internally, it implements a two-phase build: first compiling all dependencies into a cached derivation, then compiling the user's crate with those pre-built dependencies. This architecture optimizes rebuild times when only the application code changes. Key capabilities include support for git dependencies, workspace crates, custom `rustc`/`cargo` toolchains, cross-compilation (via `CARGO_BUILD_TARGET`), and automatic crate-specific overrides (e.g., adding `openssl` and `pkg-config` for the `openssl-sys` crate). The codebase is implemented entirely in pure Nix, showcasing advanced Nix patterns like recursive toml serialization, generic closure traversal, and dynamic source stub generation. The project is actively maintained, has a comprehensive test suite (fast and slow), and is widely used in the Nix ecosystem.