diff --git a/CHANGELOG.md b/CHANGELOG.md index a01c2f0..466242e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/API.md b/docs/API.md index eaa9702..4d4ab20 100644 --- a/docs/API.md +++ b/docs/API.md @@ -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"` diff --git a/lib/buildPackage.nix b/lib/buildPackage.nix index 6091dcb..ff9d0e4 100644 --- a/lib/buildPackage.nix +++ b/lib/buildPackage.nix @@ -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 // { - installCargoArtifactsMode = args.installCargoArtifactsMode or "use-zstd"; - })); + 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)