Skip to content

Releases: ipetkov/crane

v0.12.1

11 Apr 01:17
v0.12.1
445a3d2
Compare
Choose a tag to compare

0.12.1 - 2023-04-10

Added

  • vendorMultipleCargoDeps can now be used to vendor crates from multiple
    distinct Cargo.lock files. Notably this allows for building the standard
    library (via -Z build-std or equivalent) since both the project's
    and the Rust toolchain's Cargo.lock files can be vendored together

Changed

  • vendorCargoRegistries now accepts a registries parameter from the caller.
    If not specified, it will be computed via cargoConfigs. Also cargoConfigs
    is now an optional parameter which will default to [] if not specified.

Fixed

  • vendorCargoDeps correctly accepts arguments which have not set src, so
    long as one of cargoLock, cargoLockContents, or cargoLockParsed is set

v0.12.0

20 Mar 04:16
v0.12.0
2552a2d
Compare
Choose a tag to compare

0.12.0 - 2023-03-19

Added

  • Add a stubbed binary target to each "dummy" crate generated to support
    "artifact dependencies" nightly feature
    in case a crate is used as bin artifact dependency.
  • Add cargoLlvmCov to run cargo llvm-cov
  • Add cargoLockParsed option to vendorCargoDeps to support Cargo.lock
    files parsed as nix attribute sets.
  • craneLib.path can now be used as a convenience wrapper on (or drop in
    replacement of) builtins.path to ensure reproducible results whenever paths
    like ./. or ./.. are used directly.

Changed

  • Breaking (technically): mkCargoDerivation will remove the following
    attributes before lowering to mkDerivation: cargoLock, cargoLockContents
    and cargoLockParsed. If your derivation needs these values to be present
    they can be explicitly passed through via .overrideAttrs
    buildDepsOnly as dummySrc will take priority
  • The API docs have been updated to refer to craneLib (instead of just lib)
    to avoid ambiguities with pkgs.lib.
  • cargo is now invoked with --release when $CARGO_PROFILE == release instead
    of passing in --profile release to better support tools which do not
    understand the latter

Fixed

  • Fixed support for projects depending on crates utilising per-target workspace dependencies.

v0.11.3

19 Feb 22:47
v0.11.3
953b70d
Compare
Choose a tag to compare

0.11.3 - 2023-02-19

Fixed

  • Fixed an unintentional cache invalidation whenever buildDepsOnly would run
    on an unfiltered source (like src = ./.;).

Changed

  • A warning will now be emitted if a derivation's pname or version
    attributes are not set and the value cannot be loaded from the derivation's
    root Cargo.toml. To resolve it consider setting pname = "..."; or version = "..."; explicitly on the derivation.
  • A warning will now be emitted if src and dummySrc are passed to
    buildDepsOnly as dummySrc will take priority

v0.11.2

11 Feb 23:47
v0.11.2
c6b5c57
Compare
Choose a tag to compare

0.11.2 - 2023-02-11

Fixed

  • buildPackage is more tolerant of misbehaving proc macros which write to
    stdout during the build

v0.11.1

22 Jan 00:53
v0.11.1
ccea7b3
Compare
Choose a tag to compare

0.11.1 - 2023-01-21

Changed

  • Documented and made it easier to build a cargo workspace located in a
    subdirectory of the source root

Fixed

  • Previously compiled build scripts now maintain their executable bit when
    inherited
  • Workspace inheritance in git dependencies is now correctly handled

v0.11.0

26 Dec 23:08
v0.11.0
98894bb
Compare
Choose a tag to compare

0.11.0 - 2022-12-26

Added

  • Documentation is now available at crane.dev

Changed

  • Breaking: dropped compatibility for Nix versions below 2.11.0
  • Breaking: dropped compatibility for nixpkgs-22.05. nixpkgs-22.11 and
    nixpkgs-unstable are fully supported
  • Zstd compression of cargo artifacts now defaults to using as many cores as
    $NIX_BUILD_CORES allows for (or all available cores if it isn't defined)
  • Dummy sources now attempt to use the same name as their original source (minus
    the Nix store path and hash) to minimize errors with build scripts which
    expect their full path to not change between runs

v0.10.0

02 Dec 01:11
v0.10.0
fb80a68
Compare
Choose a tag to compare

0.10.0 - 2022-12-01

Added

  • A new installation mode has been defined which symlinks identical cargo
    artifacts against previously generated ones. This allows for linear space
    usage in the Nix store across many chained derivations (as opposed to using a
    zstd compressed tarball which uses quadratic space across many chained
    derivations).
  • mkDummySrc optionally accepts a dummyrs argument which allows for
    customizing the contents of the dummy Rust files that will be generated.

Changed

  • Breaking: all cargo-based derivations will now default to using symlinking
    their installed artifacts together instead of using zstd compressed tarballs.
    To get the old behavior back, set installCargoArtifactsMode = "use-zstd"; in
    the derivation.
    • Note that buildPackage will continue to use zstd compressed tarballs while
      building dependencies (unless either of cargoArtifacts or
      installCargoArtifactsMode is defined, in which case they will be honored)
  • Breaking: the format for defining crate registries has been changed: each
    registry URL should map to a set containing a downloadUrl attribute. This
    set may also define fetchurlExtraArgs (another set) which will be forwarded
    to the fetchurl invocations for crates for that registry.
  • Breaking (technically): buildDepsOnly will now only default to running
    cargo check with the --all-targets flag only if doCheck = true; is set on
    the derivation (otherwise the flag is omitted). To get the previous behavior
    back simply set cargoCheckExtraArgs = "--all-targets";.
  • registryFromGitIndex now uses shallow checkouts for better performance
  • registryFromDownloadUrl and registryFromGitIndex now allow specifying
    fetchurlExtraArgs which will be forwarded to the fetchurl invocations for
    crates for that registry

Fixed

  • Unpacking a git repository now ignores duplicate crates to match cargo's
    behavior
  • Sped up stripping references to source files
  • Dummy sources now import the core crate more robustly (playing more nicely
    with cargo-hakari)
  • Building a crate's dependencies automatically works for uefi targets

v0.9.0

29 Oct 17:23
v0.9.0
f48777a
Compare
Choose a tag to compare

0.9.0 - 2022-10-29

Changed

  • Breaking: all setup hooks have been removed from the packages flake
    output. They can still be accessed via the lib flake output.
  • Breaking: cargoBuild now only runs cargo build in a workspace, tests
    are no longer run
  • Breaking: buildDepsOnly does not automatically imply the --all-targets
    flag when invoking cargo check. Use cargoCheckExtraArgs to control this
  • buildDepsOnly now accepts cargoCheckExtraArgs for passing additional
    arguments just to the cargo check invocation. By default --all-targets
    will be used
  • buildDepsOnly now accepts cargoTestExtraArgs for passing additional
    arguments just to the cargo test invocation
  • buildPackage now delegates to mkCargoDerivation instead of cargoBuild

Fixed

  • crateNameFromCargoToml now takes workspace inheritance into account. If a
    crate does not specify package.version in its (root) Cargo.toml but does
    specify workspace.package.version then the latter will be returned.
  • Freestanding (#![no_std]) targets are now supported

v0.8.0

09 Oct 21:11
v0.8.0
f2a92d6
Compare
Choose a tag to compare

0.8.0 - 2022-10-09

Added

  • cargoTest can now be used for only running the tests of a workspace

Changed

  • Breaking (technically): build hooks now expect helper tools (like cargo,
    jq, zstd, etc.) to be present on the path instead of substituting a
    reference to a (possibly different) executable in the store.
  • mkCargoDerivation now automatically vendors dependencies if cargoVendorDir
    is not defined
  • mkCargoDerivation now automatically populates pname and version (via
    crateNameFromCargoToml) if they are not specified
  • mkCargoDerivation now defaults to an empty checkPhaseCargoCommand if not
    specified
  • cargoAudit now delegates to mkCargoDerivation instead of cargoBuild
  • cargoClippy now delegates to mkCargoDerivation instead of cargoBuild
  • cargoDoc now delegates to mkCargoDerivation instead of cargoBuild
  • cargoFmt now delegates to mkCargoDerivation instead of cargoBuild
  • cargoNextest now delegates to mkCargoDerivation instead of cargoBuild
  • cargoTarpaulin now delegates to mkCargoDerivation instead of cargoBuild

Fixed

  • Installing binaries now uses the same version of cargo as was used to build
    the package (instead of using whatever version is present in nixpkgs)

Deprecated

  • The packages flake output has been deprecated. All setup hooks can be
    accessed via the lib flake output (or via the result of the mkLib flake
    output)

v0.7.0

29 Sep 01:02
v0.7.0
755acd2
Compare
Choose a tag to compare

0.7.0 - 2022-09-28

Added

  • cargoDoc can now be used for building the documentation of a workspace
  • cleanCargoSource can now be used to filter sources to only include cargo and
    Rust files (and avoid rebuilds when irrelevant files change).
    filterCargoSources is the underlying filter implementation and can be
    composed with other filters
  • removeReferencesToVendoredSourcesHook defines a post-install hook which will
    remove any references to vendored sources from any installed binaries. Useful
    for preventing nix from considering the binaries as having a (runtime)
    dependency on said sources

Changed

  • Breaking: mkCargoDerivation now includes a default configurePhase
    which does nothing but run the preConfigure and postConfigure hooks. This
    is done to avoid breaking builds by including puts happen to have setup-hooks
    which try to claim the configure phase (such as cmake). To get the old
    behavior back, set configurePhase = null; in the derivation.
  • mkCargoDerivation (along with any of its callers like cargoBuild,
    buildPackage, etc.) now accept a stdenv argument which will override the
    default environment (coming from pkgs.stdenv) for that particular derivation
  • mkDummySrc now accepts extraScript which can be used to run a custom
    script, and therefore customize what the dummy source contains
  • buildDepsOnly now accepts dummySrc as a way to directly pass in the dummy
    source to be used. Automatically derived via args.src if not specified.

Fixed

  • cargoAudit properly keeps any audit.toml files when cleaning the source
  • buildPackage now has more robust checks to ensure that all references to
    vendored sources are removed after installation (which avoids consumers of the
    final binaries having to download the sources as well)
  • mkDummySrc how handles build scripts in a manner which ensures cargo runs
    the real script later (instead of thinking it has not changed)