buildPackage: don't inherit installPhase when calling buildDepsOnly (#297)

This commit is contained in:
Ivan Petkov 2023-04-10 18:37:58 -07:00 committed by GitHub
parent 445a3d2229
commit 0c9f468ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 6 deletions

View File

@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### [0.12.1] - 2023-04-10
### Changed
* **Breaking**: When setting a default value for `cargoArtifacts`,
`buildPackage` will now ignore `installPhase` and `installPhaseCommand` when
calling `buildPackage`. To bring back the old behavior, please specify
`cargoArtifacts` explicitly
### Added
* `vendorMultipleCargoDeps` can now be used to vendor crates from multiple
distinct `Cargo.lock` files. Notably this allows for building the standard

View File

@ -177,8 +177,10 @@ install hooks.
`target` directory, which will be reused at the start of the derivation.
Useful for caching incremental cargo builds.
- Default value: the result of `buildDepsOnly` after applying the arguments
set (with the respective default values). `installCargoArtifactsMode` will
be set to `"use-zstd"` if not specified.
set (with the respective default values).
- `installCargoArtifactsMode` will be set to `"use-zstd"` if not specified.
- `installPhase` and `installPhaseCommand` will be removed (in favor of their
default values provided by `buildDepsOnly`)
* `cargoBuildCommand`: A cargo invocation to run during the derivation's build
phase
- Default value: `"cargo build --profile release"`

View File

@ -15,8 +15,10 @@
, ...
}@args:
let
inherit (builtins) removeAttrs;
crateName = crateNameFromCargoToml args;
cleanedArgs = builtins.removeAttrs args [
cleanedArgs = removeAttrs args [
"cargoBuildCommand"
"cargoExtraArgs"
"cargoTestCommand"
@ -34,9 +36,14 @@ mkCargoDerivation (cleanedArgs // memoizedArgs // {
doCheck = args.doCheck or true;
doInstallCargoArtifacts = args.doInstallCargoArtifacts or false;
cargoArtifacts = args.cargoArtifacts or (buildDepsOnly (args // memoizedArgs // {
cargoArtifacts = args.cargoArtifacts or (
let
depsArgs = args // memoizedArgs // {
installCargoArtifactsMode = args.installCargoArtifactsMode or "use-zstd";
}));
};
in
buildDepsOnly (removeAttrs depsArgs [ "installPhase" "installPhaseCommand" ])
);
buildPhaseCargoCommand = args.buildPhaseCargoCommand or ''
cargoBuildLog=$(mktemp cargoBuildLogXXXX.json)