A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.
Go to file
Ivan Petkov 418ec86477
mkDummySrc: fix cleaning to work with Nix store overrides (#448)
* Turns out if a build is invoked with `--store` then the source
  cleaning filter will observe paths rooted at the alternative store
  which breaks out previous string handling (and results in incorrectly
  ignoring files which should be included)
2023-11-05 18:32:24 +00:00
.github ci: skip cross-musl on macOS 2023-10-18 18:05:53 -07:00
checks cargoLib.cargoDeny: init (#440) 2023-10-20 21:45:03 +00:00
ci ci: pin all example inputs with a single testing flake.lock (#436) 2023-10-19 00:30:52 +00:00
docs installCargoArtifactsHook: change default installation mode to use-zstd (#442) 2023-10-20 22:28:41 +00:00
examples cargoLib.cargoDeny: init (#440) 2023-10-20 21:45:03 +00:00
extra-tests mkDummySrc: fix cleaning to work with Nix store overrides (#448) 2023-11-05 18:32:24 +00:00
lib mkDummySrc: fix cleaning to work with Nix store overrides (#448) 2023-11-05 18:32:24 +00:00
pkgs craneUtils: build with rustPlatform (#431) 2023-10-17 00:12:57 +00:00
test Update internal flake.lock (#443) 2023-10-24 16:56:53 +00:00
.envrc Move all tests (except for formatting) out of flake checks 2021-12-30 17:18:17 -08:00
.git-blame-ignore-revs Ignore blame from fmt revision 2022-11-20 16:31:44 -08:00
.gitignore mkDummySrc: fix cleaning to work with Nix store overrides (#448) 2023-11-05 18:32:24 +00:00
CHANGELOG.md mkDummySrc: fix cleaning to work with Nix store overrides (#448) 2023-11-05 18:32:24 +00:00
default.nix flake: deprecate the packages flake output (#130) 2022-10-09 10:28:48 -07:00
flake.lock Update flake.lock (#447) 2023-11-03 17:00:22 +00:00
flake.nix chore: drop all public dependencies except for nixpkgs (#437) 2023-10-19 00:57:24 +00:00
LICENSE Add LICENSE 2022-01-17 15:05:45 -08:00
README.md Trunk support (#299) 2023-04-29 12:34:39 -07: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-audit for vulnerability scanning
  • cargo-nextest a next-generation test runner
  • cargo-tarpaulin for code coverage
  • trunk for wasm frontend apps

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.