ipetkov/crane

Nixcrane.dev

A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.

nixosnixpkgsnixrustcargocrate
Star Growth
Stars
1.5k
Forks
140
Weekly Growth
+5
Issues
32
5001k
Jan 2023Mar 2024Jun 2025Sep 2026
README

Crane

A Nix library for building cargo projects.

  • Source fetching: automatically done using a Cargo.lock file
  • Incremental: build your workspace dependencies just once, then quickly lint, build, and test changes to your project without slowing down
  • Composable: split builds and tests into granular steps. Gate CI without burdening downstream consumers building from source.

Features

  • Automatic vendoring of dependencies in a way that works with Nix
    • Alternative cargo registries are supported (with a minor configuration change)
    • Git dependencies are automatically supported without additional configuration.
      • Cargo retains the flexibility to only use these dependencies when they are actually needed, without forcing an override for the entire workspace.
  • Reusing dependency artifacts after only building them once
  • clippy checks
  • rustfmt checks
  • cargo-doc generation
  • And support for a number of popular tools such as:

Getting Started

The easiest way to get started is to initialize a flake from a template:

# Start with a comprehensive suite of tests
nix flake init -t github:ipetkov/crane#quick-start

Otherwise check out the examples and templates for more detailed examples. An API Reference is also available.

Compatibility Policy

Breaking changes can land on the master branch at any time, so it is recommended you use a versioning strategy when consuming this library (for example, using something like flakes or niv).

Tagged releases will be cut periodically and changes will be documented in the CHANGELOG. Release versions will follow Semantic Versioning.

The test suite is run against the latest stable nixpkgs release, as well as nixpkgs-unstable. Any breakage on those channels is considered a bug and should be reported as such.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion by you, shall be licensed as MIT, without any additional terms or conditions.

Related repositories
NixOS/nixpkgs

Nix Packages collection & NixOS

NixMIT Licensenixpkgsnix
26.1k20k
nix-community/home-manager

Manage a user environment using Nix [maintainer=@khaneliman, @rycee]

NixMIT Licensenixnixpkgs
nix-community.github.io/home-manager/
10.3k2.5k
xonsh/xonsh

🐚 Python-powered shell. Full-featured, cross-platform and AI-friendly.

PythonPyPIOtherxonshdevops
xon.sh
9.6k740
nix-community/awesome-nix

😎 A curated list of the best resources in the Nix community [maintainer=@cyntheticfox]

awesomeCreative Commons Zero v1.0 Universalawesome-listawesome
nix-community.github.io/awesome-nix/
5.4k200
NixOS/nix.dev

Official documentation for getting things done with Nix.

TypeScriptnpmtutorialCreative Commons Attribution Share Alike 4.0 Internationalnixdocumentation
nix.dev
4k337
Misterio77/nix-starter-configs

Simple and documented config templates to help you get started with NixOS + home-manager + flakes. All the boilerplate you need!

NixCreative Commons Zero v1.0 Universaldotfilesflakes
3.8k178
ilysenko/codex-desktop-linux

Unofficial ChatGPT desktop app for Linux (formerly the Codex app), built locally from OpenAI’s official macOS app. Includes Chat, Work, and Codex. Packages for Debian/Ubuntu (.deb), Fedora/openSUSE (.rpm), Arch (pacman), Nix/NixOS, and AppImage, with Wayland and X11 support.

JavaScriptnpmappMIT Licenseai-codingappimage
3.8k489
dustinlyons/nixos-config

General purpose Nix starter template for macOS or NixOS w/ step-by-step instructions

NixBSD 3-Clause "New" or "Revised" Licensedotfilesnix
3.6k203
nix-community/nixos-anywhere

Install NixOS everywhere via SSH [maintainers=@Mic92 @Lassulus @phaer @Enzime @a-kenji]

ShellcliMIT Licensedeploymentnix
nix-community.github.io/nixos-anywhere/
3.4k210
ryan4yin/nixos-and-flakes-book

:hammer_and_wrench: :heart: Want to know NixOS & Flakes in detail? Looking for a beginner-friendly tutorial? Then you've come to the right place! 想要学习使用 NixOS 与 Flakes 吗?在寻找一份新手友好的教程?那你可来对地方了!

TypeScriptnpmtutorialCreative Commons Attribution Share Alike 4.0 Internationallinuxnix
nixos-and-flakes.thiscute.world
3.3k159
nix-community/nh

Yet another Nix CLI helper. [Maintainers=@NotAShelf, @faukah]

Rustcrates.iocliEuropean Union Public License 1.2nixosnix
3.2k125
Mic92/sops-nix

Atomic secret provisioning for NixOS based on sops

NixMIT Licensenixossops
3.2k231