All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Added a number of fileset helpers to more easily compose source filtering:
fileset.cargoTomlAndLock
: forCargo.toml
andCargo.lock
filesfileset.commonCargoSources
: for files commonly used by cargo projectsfileset.configToml
: forconfig.toml
filesfileset.rust
: for*.rs
filesfileset.toml
: for*.toml
files
buildTrunkPackage
will pass in--release=true
(instead of just--release
) for trunk versions 0.21 or higher to avoid argument ambiguitiesremoveReferencesToVendoredSourcesHook
avoids referencing/dev/fd
directly since it may not be present on certain platforms
0.19.1 - 2024-10-12
cargoDocTest
is now available as an alternative tocargoTest
which runs only doc tests.
buildDepsOnly
now setsCRANE_BUILD_DEPS_ONLY
as an environment variable when it runs. Build hooks can use this as a shortcut to determine whether running inside of abuildDepsOnly
derivation in case they need to tailor their behavior accordingly.
- Vendoring dependencies avoids creating malformed TOML configurations in situations where registry name/url definitions cannot be found. When this happens a warning will be printed out during evaluation to highlight the issue.
0.19.0 - 2024-09-25
taploFmt
is now available for checking TOML formatting
- Breaking (technically):
buildPackage
no longer addsjq
tonativeBuildInputs
as doing so can result in rebuilding any*-sys
crates which rely onPKG_CONFIG_PATH
remaining stable - Breaking:
downloadCargoPackageFromGit
now takeshash
instead ofsha256
when specifying an output hash for the download installFromCargoBuildLogHook
no longer assumes or requires thatjq
is available on$PATH
and will instead directly referencepkgs.jq
downloadCargoPackageFromGit
will now setfetchLFS = true
when fetching git repos with defined output hashes
cargoDoc
correctly honorsdocInstallRoot
when specifiedcargoDoc
falls back to installing from./target/doc
even if$CARGO_BUILD_TARGET
is set but./target/$CARGO_BUILD_TARGET/doc
does not exist
- The deprecated top-level (flake) attribute
lib
no longer exists. Please usemkLib
with an instance ofpkgs
instead.
0.18.1 - 2024-08-22
- Fixed vendoring dependencies from an alternative registry which they themselves have dependencies on crates from other registries.
- Fixed
cargoNextest
's positioning ofcargoExtraArgs
to form a valid command invocation when specified.
0.18.0 - 2024-07-05
- Breaking: dropped compatibility for Nix versions below 2.18.2
- Breaking: dropped compatibility for nixpkgs-23.11.
- The guidance around using (both)
cleanCargoSource
andpath
has been updated. Namely, it is no longer necessary to call both (e.g.craneLib.cleanCargoSource (craneLib.path ./.)
): it is recommended to either usecraneLib.cleanCargoSource ./.
directly (if the default source cleaning is desired) orcraneLib.path ./.
(if not). overrideToolchain
has been updated to better handle cross-compilation splicing for a customized toolchain. This means thatoverrideToolchain
should now be called with a function which constructs said toolchain for any givenpkgs
instantiation. For example:craneLib.overrideToolchain (p: p.rust-bin.stable.latest.default)
- The cross compilation example also hows how to set the
TARGET_CC
environment variable which may be required by some build scripts to function properly vendorCargoDeps
andcrateNameFromCargoToml
do their best to avoid IFD whensrc
is the result oflib.cleanSourceWith
(and by extensioncleanCargoSource
)removeReferencesToVendoredSources
handles the edge case wherecargoVendorDir
does not point to a path within the Nix store- It is now possible to use
.overrideScope
to change what instance ofcraneUtils
will be used during vendoring.
0.17.3 - 2024-06-02
removeReferencesToVendoredSources
correctly signs aarch64-darwin builds (which was accidentally broken in 0.17.2)
0.17.2 - 2024-05-26
removeReferencesToVendoredSources
has been optimized to search for source references only once. For derivations which install many files, this phase can run up to 99% faster than before.cleanCargoToml
now cleans underscored versions of the same attributes (e.g.lib.proc-macro
andlib.proc_macro
)
0.17.1 - 2024-05-19
downloadCargoPackage
anddownloadCargoPackageFromGit
no longer run the fixup phase by default, avoiding issues with source directories and files being moved to different locationsdownloadCargoPackage
now unpacks and installs from a fresh directory, avoiding having build environment files (likeenv-vars
) appearing in the output
0.17.0 - 2024-05-18
cargoDoc
now supportsdocInstallRoot
to influence which directory will be installed to$out/share
(which can be useful when cross-compiling). By default$CARGO_TARGET_DIR
and$CARGO_BUILD_TARGET
(if set) will be taken into accountcrateNameFromCargoToml
now supports selecting a derivation name by settingpackage.metadata.crane.name
orworkspace.metadata.crane.name
in the rootCargo.toml
vendorCargoDeps
,vendorCargoRegistries
,vendorGitDeps
, andvendorMultipleCargoDeps
now support arbitrary overrides (i.e. patching) at the individual crate/repo level when vendoring sources.
- Breaking
cargoAudit
no longer acceptscargoExtraArgs
(since it does not support the regular set ofcargo
flags like most cargo-commands do, it does not make much sense to propagate those flags through) buildTrunkPackage
now setsenv.TRUNK_SKIP_VERSION_CHECK = "true";
if not specified
- In the future,
crateNameFromCargoToml
will stop consideringworkspace.package.name
in the rootCargo.toml
when determining the crate name. This attribute is not recognized by cargo (which will emit its own warnings about it) and should be avoided going forward. - In the future,
crane.lib.${system}
will be removed. Please switch to using(crane.mkLib nixpkgs.lib.${system})
as an equivalent alternative.
0.16.6 - 2024-05-04
- Same as 0.16.5 but with the correct tag deployed to Flakestry/FlakeHub
0.16.5 - 2024-05-04
- Workspace inheritance for git dependencies now ignores (removes) all comments
around dependency declarations to work around a mangling bug in
toml_edit
(see #527 and toml-rs/toml#691)
0.16.4 - 2024-04-07
- Added a warning if an unsupported version of nixpkgs is used
cargoNextest
now supports settingwithLlvmCov
which will automatically runcargo llvm-cov nextest
. Note thatwithLlvmCov = true;
is (currently) only supported whenpartitions = 1;
inheritCargoArtifactsHook
andinstallCargoArtifactsHook
now correctly handle the case whenCARGO_TARGET_DIR
is set to a nested directory- Dependency vendoring now correctly takes unused patch dependencies into account
0.16.3 - 2024-03-19
- Sources are now fetched crates.io's CDN, following cargo's (new) default behavior.
vendorMultipleCargoDeps
correctly listsregistries
as an optional parameter
0.16.2 - 2024-02-21
cleanCargoToml
now also strips out[lints]
and[workspace.lints]
definitions. This means avoiding unnecessarily rebuilding dependencies when the lint definitions change, and it avoids issues with failing to build dummified sources which might have violated a lint marked asdeny
orforbid
- Fixed an edge case with inheriting workspace dependencies where the workspace
dependency is a string (e.g.
foo = "0.1.2"
) but the crate definition is a table (e.g.foo = { workspace = true, optional = true }
)
0.16.1 - 2024-01-28
buildDepsOnly
now ignores any outputs (besides the defaultout
)
buildDepsOnly
no longer fails when workspace is configured with#[deny(unused-extern-crates)]
vendorCargoDeps
(and friends) are now much more friendly to cross-compilation definitions. Specifically, source vendoring will always build dependencies to run on the build machine (and not for the host we're cross compiling to).
0.16.0 - 2024-01-18
- Breaking: dropped compatibility for Nix versions below 2.18.1
- Breaking: dropped compatibility for nixpkgs-23.05.
buildTrunkPackage
has a new argument,wasm-bindgen-cli
must be set to avoid mismatching versions between the wasm-bindgen library and CLI tool.
- Workspace inheritance of
lints
in git dependencies is now correctly handled
0.15.1 - 2023-11-30
buildDepsOnly
will now assumecargoTestExtraArgs = "--no-run";
if not specified (since there is no point to trying to run tests with the stripped sources). To get the old behavior back, setcargoTestExtraArgs = "";
buildTrunkPackage
'spreConfigure
script to fail quicker with a more obvious error message if dependencies at not appropriately met
0.15.0 - 2023-11-05
cargoDeny
added for runningcargo-deny
.installCargoArtifactsHook
will now pass along the contents of$zstdCompressionExtraArgs
as arguments tozstd
when compressing artifacts. This allows for tailoring compression behavior, for example, by settingzstdCompressionExtraArgs = "-19";
on the derivation.
- The
use-zstd
artifact installation mode now uses a chained, incremental approach to avoid redundancy. Old behavior (taking a full snapshot of the cargo artifacts) can be achieved by settingdoCompressAndInstallFullArchive = true
. - The default
installCargoArtifactsMode
has been changed touse-zstd
, meaning cargo artifacts will be compressed to a series of incremental, zstd compressed tarballs across derivations. To get the old behavior back, setinstallCargoArtifactsMode = "use-symlink"
to any derivation which produces cargo artifacts. - All dependencies (outside of
nixpkgs
) have been dropped from the (main) flake.lock file so they do not pollute downstream projects' lock files.
mkDummySrc
now properly handles file cleaning (and file including) when a build is invoked with a--store ...
override
0.14.3 - 2023-10-17
craneUtils
will now be built with therustPlatform
provided by nixpkgs instead of the currently configured toolchain. This should hopefully result in fewer surprises for those testing with really old MSRV toolchains.devShell
will now additionally includeclippy
andrustfmt
from the currently configured toolchain
replaceCargoLockHook
now runs as aprePatch
hook (rather thanpostUnpack
) which correctly replaces theCargo.lock
in the source directory rather than the parent directory
0.14.2 - 2023-10-15
replaceCargoLockHook
can now be used to easily replace or insert aCargo.lock
file in the current derivation
cargoAudit
will pass--ignore yanked
by default ifcargoAuditExtraArgs
are not specified. This is becausecargo-audit
cannot check for yanked crates from inside of the sandbox. To get the old behavior back, setcargoAuditExtraArgs = "";
.
- Fixed handling of Cargo workspace inheritance for git-dependencies where said crate relies on reading non-TOML metadata (i.e. comments) from its Cargo.toml at build time. (#407)
- Fixed handling of dummy target names to avoid issues with
cargo doc
. (#410) - When using
installCargoArtifactsMode = "use-zstd";
all files will be marked as user-writable while compressing removeReferencesToVendoredSources
now signsaarch64-darwin
binaries. (#418)
0.14.1 - 2023-09-23
- Fixed a bug where
buildPackage
would fail to inherit artifacts from dependency crates ifcargoArtifacts
was not explicitly specified.
0.14.0 - 2023-09-21
- Added
devShell
, a thin wrapper aroundpkgs.mkShell
which automatically providescargo
andrustc
. - Added the ability to specify output hashes of git dependencies for fully
offline evaluations. The
outputHashes
attribute can now be optionally specified invendorCargoDeps
,vendorGitDeps
,vendorMultipleCargoDeps
, or anything else which delegates to them.
- Breaking (technically):
buildDepsOnly
,buildPackage
,cargoBuild
,cargoClippy
,cargoDoc
,cargoLlvmCov
, andcargoTest
's defaults have been changed such that ifcargoExtraArgs
have not been set, a default value of--locked
will be used. This ensures that a project's committedCargo.lock
is exactly what is expected (without implicit changes at build time) but this may end up rejecting builds which were previously passing. To get the old behavior back, setcargoExtraArgs = "";
- Breaking:
cargoDoc
will no longer install cargo artifacts by default. SetdoInstallCargoArtifacts = true;
to get the old behavior back. cargoDoc
will now install generated documentation in$out/share/doc
- Fixed a bug when testing proc macro crates with
cargoNextest
on macOS. (#376) - Replaced various internal usages of
runCommandLocal
withrunCommand
for more optimal behavior when downloading cached artifacts
0.13.1 - 2023-08-22
buildTrunkPackage
will now usedart-sass
instead ofnodePackages.sass
- Vendoring git dependencies will now always resolve symlinks inside of a crate's directory. This allows for symlinks inside of a crate's directory to possibly refer to files at the root of the git repo itself (via symlink) and have those contents preserved during vendoring.
0.13.0 - 2023-08-07
buildPackage
now supports installingdylib
targets- Added support for sparse registries
- Breaking: dropped compatibility for Nix versions below 2.13.3
- Breaking: dropped compatibility for nixpkgs-22.05. nixpkgs-23.05 and
- Breaking (technically): if
buildPackage
is called without settingcargoArtifacts
, the defaultbuildDepsOnly
invocation will now stop running any installation hooks - Breaking (technically):
buildPackage
no longer installs cargo binary dependencies (i.e. when thebindeps
feature is used) by default inheritCargoArtifactsHook
will now symlink dependency.rlib
and.rmeta
files. This means that derivations which reuse existing cargo artifacts will run faster as fewer files (and bytes!) need to be copied around. To disable this behavior, setdoNotLinkInheritedArtifacts = true;
.cargoTarpaulin
will now setdoNotLinkInheritedArtifacts = true;
unless otherwise specified- Update
crane-utils
dependencies for successful build in nightly Rust (2023-06-28)
0.12.2 - 2023-06-06
- Added support for the Trunk wasm app build tool
resolver
key is no longer cleaned from Cargo.toml
buildTrunkPackage
will now strip references to store files by defaultbuildTrunkPackage
will now set the rightwasm-opt
version
0.12.1 - 2023-04-10
- Breaking: When setting a default value for
cargoArtifacts
,buildPackage
will now ignoreinstallPhase
andinstallPhaseCommand
when callingbuildPackage
. To bring back the old behavior, please specifycargoArtifacts
explicitly
vendorMultipleCargoDeps
can now be used to vendor crates from multiple distinctCargo.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'sCargo.lock
files can be vendored together
vendorCargoRegistries
now accepts aregistries
parameter from the caller. If not specified, it will be computed viacargoConfigs
. AlsocargoConfigs
is now an optional parameter which will default to[]
if not specified.
vendorCargoDeps
correctly accepts arguments which have not setsrc
, so long as one ofcargoLock
,cargoLockContents
, orcargoLockParsed
is set
0.12.0 - 2023-03-19
- 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 runcargo llvm-cov
- Add
cargoLockParsed
option tovendorCargoDeps
to supportCargo.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.
- Breaking (technically):
mkCargoDerivation
will remove the following attributes before lowering tomkDerivation
:cargoLock
,cargoLockContents
andcargoLockParsed
. If your derivation needs these values to be present they can be explicitly passed through via.overrideAttrs
buildDepsOnly
asdummySrc
will take priority - The API docs have been updated to refer to
craneLib
(instead of justlib
) to avoid ambiguities withpkgs.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 support for projects depending on crates utilising per-target workspace dependencies.
0.11.3 - 2023-02-19
- Fixed an unintentional cache invalidation whenever
buildDepsOnly
would run on an unfiltered source (likesrc = ./.;
).
- A warning will now be emitted if a derivation's
pname
orversion
attributes are not set and the value cannot be loaded from the derivation's rootCargo.toml
. To resolve it consider settingpname = "...";
orversion = "...";
explicitly on the derivation. - A warning will now be emitted if
src
anddummySrc
are passed tobuildDepsOnly
asdummySrc
will take priority
0.11.2 - 2023-02-11
buildPackage
is more tolerant of misbehaving proc macros which write to stdout during the build
0.11.1 - 2023-01-21
- Documented and made it easier to build a cargo workspace located in a subdirectory of the source root
- Previously compiled build scripts now maintain their executable bit when inherited
- Workspace inheritance in git dependencies is now correctly handled
0.11.0 - 2022-12-26
- Documentation is now available at crane.dev
- 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
0.10.0 - 2022-12-01
- 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.
- 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 ofcargoArtifacts
orinstallCargoArtifactsMode
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 a
downloadUrl
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 runningcargo 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 specifyingfetchurlExtraArgs
which will be forwarded to thefetchurl
invocations for crates for that registry
- 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
0.9.0 - 2022-10-29
- 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
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
0.8.0 - 2022-10-09
cargoTest
can now be used for only running the tests of a workspace
- 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
(viacrateNameFromCargoToml
) 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
- 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)
- 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)
0.7.0 - 2022-09-28
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
- 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.
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)
0.6.0 - 2022-09-07
- Added
cargoNextest
for running tests via cargo-nextest - Added
cargoAudit
for running cargo-audit with a provided advisory database instance.
- 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 from
Cargo.lock
and a hint towards resolution
- Breaking:
vendorGitDeps
will only include crates referenced by theCargo.lock
file, meaning any extraneous crates which happen to be present in the git repository will be ignored.
0.5.1 - 2022-07-20
- Added
.overrideToolchain
as a convenience for using a custom rust toolchain
- Fixed an issue where
mkDummySrc
would produce incorrect results for filtered sources: #46
0.5.0 - 2022-06-12
- 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 ofbuiltins.fromTOML
- Improved support for consuming
crane
without using flakes - The
nix-std
dependency has been dropped
0.4.1 - 2022-05-29
- Dummy source derivations go to greater lengths to only depend on the files
they consume. Specifying the entire flake source as an input (e.g. via
buildPackage { src = self; }
) now avoids rebuilding everything from scratch whenever any file is changed. #28
0.4.0 - 2022-05-10
- Breaking: the previously named
utils
flake input has been renamed toflake-utils
buildDepsOnly
now adds--all-targets
to the defaultcargo check
invocation. This allows caching all artifacts (including from dev-dependencies) such that tools like clippy don't have to generate them every time they run.- Templates now use the newer flake format accepted by Nix 2.8 (e.g.
{packages,overlays,devShells}.default
, etc.)
- Fixed project and template flakes to avoid superfluous follows declaration for
flake-utils
- Fixed quoting of relative paths to allow building with external sources
0.3.3 - 2022-02-24
- Use
lib.groupBy
ifbuiltins.groupBy
isn't available (i.e. if a Nix version earlier than 2.5 is used) - The cross compilation example also hows how to set the
HOST_CC
environment variable which may be required by some build scripts to function properly
0.3.2 - 2022-02-18
- Fixed handling git dependencies whose locked revision is not on the repository's main branch
0.3.1 - 2022-02-17
- Added template and example for cross compiling to other platforms
- Added template and example for building static binaries using musl
cargoClippy
andcargoTarpaulin
will install cargo artifacts by default (or install an emptytarget
directory if there are none). This allows for more easily chaining derivations if doing so is desired.- This can be disabled by setting
doInstallCargoArtifacts = false;
in the derivation
- This can be disabled by setting
- Fixed an issue where cross compiling would try to needlessly cross compile rustc and cargo themselves
0.3.0 - 2022-02-11
downloadCargoPackageFromGit
has been added to handle downloading and unpacking a cargo workspace from a git repositoryvendorCargoRegistries
has been added to handle vendoring crates from all registries used in aCargo.lock
filevendorGitDeps
has been added to handle vendoring crates from all git sources used in aCargo.lock
file
vendorCargoDeps
now automatically handles git dependencies by default- Git dependencies will be vendored as another source in the output derivation
- The cargo configuration is done such that the sources are available to use
when it decides, without overriding that crate for the entire workspace
- For example, if your workspace contains a crate only used for testing which has a git dependency of a crate used by other parts of the workspace, then only that crate will use the git dependency. The rest of the workspace will continue to use the crates.io version, just like cargo behaves when used outside of Nix.
0.2.1 - 2022-02-11
cargoFmt
will install cargo artifacts by default (or install an emptytarget
directory if there are none). This allows for more easily chaining derivations if doing so is desired.- This can be disabled by setting
doInstallCargoArtifacts = false;
in the derivation
- This can be disabled by setting
0.2.0 - 2022-01-30
- Support for alternative cargo registries
urlForCargoPackage
now takes configured registries into account when downloading crate sources- Breaking:
vendorCargoDeps
now vendors each unique registry as a subdirectory within the derivation's output. Aconfig.toml
file is also placed at the output root which contains the necessary configurations to point cargo at the vendored sources. configureCargoVendoredDepsHook
is now aware of the updatedvendorCargoDeps
output format, and will use theconfig.toml
file it generates if it is present. Otherwise it will fall back to the previous behavior (which is treat the entire directory as only vendoring crates.io).- Source vendoring now uses
runCommandLocal
(instead ofrunCommand
) to reduce network pressure in trying to fetch results which can quickly be built locally - Searching for
Cargo.toml
or.cargo/config.toml
files is now done more efficiently
- First release