Skip to content

0.10.0

Compare
Choose a tag to compare
@kolloch kolloch released this 13 Jun 10:24
· 651 commits to master since this release

Warning: This release does not work on Mac OS with a recent nixpkgs. Help wanted.
Warning: the buildRustCrate argument will be removed soon.

Help needed! I don't have the resources to meaningfully advance this project. Thank
you for all the valuable contributions but I'd appreciate a co-maintainer who
is motivated to put in some time into reviewing PRs, updating docs, fixing bugs, ..

New "calling convention"

The recommended convention to use Cargo.nix files generated by crate2nix has
changed. Instead of callPackage you know should use import:

let cargo_nix = import ./Cargo.nix { inherit pkgs; };
in cargo_nix.workspaceMembers."${your_crate_name}".build

The reason is that the deprecated buildRustPackage argument gets automatically
supplied from pkgs.buildRustPackage by pkgs.callPackage. This causes problems
when cross compiling.

This was debugged by @symphorien, thank you!

New: Enable optional create feature if sub feature was enabled

Enable a feature with the same name of an optional dependency, if the optional
dependency is indirectly enabled by enabling one of its features.

This mimicks the behavior of Cargo which is explained in the note
here.

Thank you @pandaman64!

This fixes the following isues:

  • (#146)[https://github.com//issues/146]
    Features fail to contain optional dependencies that got enabled indirectly
  • (#182)[https://github.com//issues/182]
    Can't build crate with dependency num 0.4.0

New: Customize test commands

Want to customize your test execution? Use the testPreRun and testPostRun
crate attributes (next to runTests, see
README.md). crate2nix executes the
bash snippets in testPreRun and testPostRun directly before and after the
actual test command, and in the same shell. Some example use-cases include:

  • Setting some environment variable that is needed for the test.

  • Setting (and then unsetting) the bash set +e option to not fail the
    derivation build even if a test fails. This is quite useful if your tests are
    not flaky and you want to cache failures.

Thank you @Fuuzetsu!