Releases: ipetkov/crane
Releases · ipetkov/crane
v0.11.2
v0.11.1
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
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
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 adummyrs
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, setinstallCargoArtifactsMode = "use-zstd";
in
the derivation.- Note that
buildPackage
will continue to use zstd compressed tarballs while
building dependencies (unless either ofcargoArtifacts
or
installCargoArtifactsMode
is defined, in which case they will be honored)
- Note that
- Breaking: the format for defining crate registries has been changed: each
registry URL should map to a set containing adownloadUrl
attribute. This
set may also definefetchurlExtraArgs
(another set) which will be forwarded
to thefetchurl
invocations for crates for that registry. - Breaking (technically):
buildDepsOnly
will now only default to running
cargo check
with the--all-targets
flag only ifdoCheck = true;
is set on
the derivation (otherwise the flag is omitted). To get the previous behavior
back simply setcargoCheckExtraArgs = "--all-targets";
. registryFromGitIndex
now uses shallow checkouts for better performanceregistryFromDownloadUrl
andregistryFromGitIndex
now allow specifying
fetchurlExtraArgs
which will be forwarded to thefetchurl
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
withcargo-hakari
) - Building a crate's dependencies automatically works for uefi targets
v0.9.0
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 thelib
flake output. - Breaking:
cargoBuild
now only runscargo build
in a workspace, tests
are no longer run - Breaking:
buildDepsOnly
does not automatically imply the--all-targets
flag when invokingcargo check
. UsecargoCheckExtraArgs
to control this buildDepsOnly
now acceptscargoCheckExtraArgs
for passing additional
arguments just to thecargo check
invocation. By default--all-targets
will be usedbuildDepsOnly
now acceptscargoTestExtraArgs
for passing additional
arguments just to thecargo test
invocationbuildPackage
now delegates tomkCargoDerivation
instead ofcargoBuild
Fixed
crateNameFromCargoToml
now takes workspace inheritance into account. If a
crate does not specifypackage.version
in its (root) Cargo.toml but does
specifyworkspace.package.version
then the latter will be returned.- Freestanding (
#![no_std]
) targets are now supported
v0.8.0
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 ifcargoVendorDir
is not definedmkCargoDerivation
now automatically populatespname
andversion
(via
crateNameFromCargoToml
) if they are not specifiedmkCargoDerivation
now defaults to an emptycheckPhaseCargoCommand
if not
specifiedcargoAudit
now delegates tomkCargoDerivation
instead ofcargoBuild
cargoClippy
now delegates tomkCargoDerivation
instead ofcargoBuild
cargoDoc
now delegates tomkCargoDerivation
instead ofcargoBuild
cargoFmt
now delegates tomkCargoDerivation
instead ofcargoBuild
cargoNextest
now delegates tomkCargoDerivation
instead ofcargoBuild
cargoTarpaulin
now delegates tomkCargoDerivation
instead ofcargoBuild
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 thelib
flake output (or via the result of themkLib
flake
output)
v0.7.0
0.7.0 - 2022-09-28
Added
cargoDoc
can now be used for building the documentation of a workspacecleanCargoSource
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 filtersremoveReferencesToVendoredSourcesHook
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 defaultconfigurePhase
which does nothing but run thepreConfigure
andpostConfigure
hooks. This
is done to avoid breaking builds by including puts happen to have setup-hooks
which try to claim the configure phase (such ascmake
). To get the old
behavior back, setconfigurePhase = null;
in the derivation. mkCargoDerivation
(along with any of its callers likecargoBuild
,
buildPackage
, etc.) now accept astdenv
argument which will override the
default environment (coming frompkgs.stdenv
) for that particular derivationmkDummySrc
now acceptsextraScript
which can be used to run a custom
script, and therefore customize what the dummy source containsbuildDepsOnly
now acceptsdummySrc
as a way to directly pass in the dummy
source to be used. Automatically derived viaargs.src
if not specified.
Fixed
cargoAudit
properly keeps anyaudit.toml
files when cleaning the sourcebuildPackage
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)
v0.6.0
0.6.0 - 2022-09-07
Added
- Added
cargoNextest
for running tests via cargo-nextest - Added
cargoAudit
for running cargo-audit
with a provided advisory database instance.
Changed
- Breaking: the
--workspace
flag is no longer set for all cargo commands
by default. The previous behavior can be recovered by settingcargoExtraArgs = "--workspace";
in any derivation. - Breaking: the
$CARGO_PROFILE
environment variable can be used to specify
which cargo-profile all invocations use (by defaultrelease
will be used).
Technically breaking if the default command was overridden for any derivation;
setCARGO_PROFILE = "";
to avoid telling cargo to use a release build. - Breaking:
cargoTarpaulin
will use the release profile by default - Breaking:
cargoClippy
'scargoClippyExtraArgs
now default to
"--all-targets"
instead of being specified as the cargo command itself. If
you have setcargoClippyExtraArgs
to an explicit value and wish to retain
the previous behavior you should prepend"--all-targets"
to it. - Breaking:
remapSourcePathPrefixHook
and thedoRemapSourcePathPrefix
option have been removed, and the behavior ofbuildPackage
has been updated
to break false dependencies on the crate sources from the final binaries
(which was the old behavior of thedoRemapSourcePathPrefix
option). To
disable this behavior, set thedoNotRemoveReferencesToVendorDir
environment
variable to any non-empty string. - All cargo invocations made during the build are automatically logged
- Vendoring git dependencies will throw a descriptive error message if a locked
revision is missing fromCargo.lock
and a hint towards resolution
Fixed
- Breaking:
vendorGitDeps
will only include crates referenced by the
Cargo.lock
file, meaning any extraneous crates which happen to be present in
the git repository will be ignored.
v0.5.1
v0.5.0
0.5.0 - 2022-06-12
Changed
- Breaking: dropped compatibility for Nix versions below 2.8.1
- Breaking: updated all flake attributes to follow the new
.default
guidance as per Nix's warnings. Specifically:- Crane's default overlay is now available at
.overlays.default
(previously
.overlay
) - All templates now use
{app,devShells,packages}.default
as well
- Crane's default overlay is now available at
- Breaking:
lib.fromTOML
andlib.toTOML
have been removed in favor of
builtins.fromTOML
- Improved support for consuming
crane
without using flakes - The
nix-std
dependency has been dropped