A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.
Go to file
2024-08-24 20:58:19 +00:00
.github chore(deps): bump DeterminateSystems/update-flake-lock from 21 to 23 (#656) 2024-07-01 17:32:16 -07:00
checks chore(deps): bump openssl from 0.10.64 to 0.10.66 in /checks/codesign (#670) 2024-07-23 01:48:59 +00:00
ci ci: fix dependency pinning 2024-08-05 18:25:32 -07:00
docs buildPackage: do not add jq to nativeBuildInputs (#685) 2024-08-22 16:24:53 -07:00
examples chore: bump all example Cargo.locks (#686) 2024-08-24 20:58:19 +00:00
extra-tests Try to avoid IFD in vendorCargoDeps and crateNameFromCargoToml; also avoid recommending nesting cleanCargoSource and path (#641) 2024-06-10 20:53:46 -07:00
lib buildPackage: do not add jq to nativeBuildInputs (#685) 2024-08-22 16:24:53 -07:00
pkgs crane-utils: bump dependencies (#609) 2024-05-04 23:12:35 +00:00
test Update internal flake.lock (#679) 2024-08-18 18:36:20 +00:00
.envrc chore: update envrc and ignore .direnv 2024-04-30 20:56:19 -07:00
.git-blame-ignore-revs Ignore blame from fmt revision 2022-11-20 16:31:44 -08:00
.gitignore chore: update envrc and ignore .direnv 2024-04-30 20:56:19 -07:00
CHANGELOG.md buildPackage: do not add jq to nativeBuildInputs (#685) 2024-08-22 16:24:53 -07:00
default.nix Splice overrideToolchain (#652) 2024-06-29 11:29:52 -07:00
flake.lock Update flake.lock (#680) 2024-08-23 01:39:19 +00:00
flake.nix Add build-std and quick-start-workspace as flake templates (#665) 2024-07-15 15:49:38 +00:00
LICENSE Add LICENSE 2022-01-17 15:05:45 -08:00
README.md chore: tweak README 2023-11-05 13:13:22 -08:00
shell.nix chore: drop all public dependencies except for nixpkgs (#437) 2023-10-19 00:57:24 +00:00

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.