installCargoArtifactsHook: change default installation mode to use-zstd (#442)

This commit is contained in:
Ivan Petkov 2023-10-20 22:28:41 +00:00 committed by GitHub
parent f8f1b3fc5b
commit 758ae44222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 6 deletions

View File

@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
approach to avoid redundancy. Old behavior (taking a full snapshot of the approach to avoid redundancy. Old behavior (taking a full snapshot of the
cargo artifacts) can be achieved by setting `doCompressAndInstallFullArchive = cargo artifacts) can be achieved by setting `doCompressAndInstallFullArchive =
true`. true`.
* The default `installCargoArtifactsMode` has been changed to `use-zstd`,
meaning cargo artifacts will be compressed to a series of incremental, zstd
compressed tarballs across derivations. To get the old behavior back, set
`installCargoArtifactsMode = "use-symlink"` to any derivation which produces
cargo artifacts.
* All dependencies (outside of `nixpkgs`) have been dropped from the (main) * All dependencies (outside of `nixpkgs`) have been dropped from the (main)
flake.lock file so they do not pollute downstream projects' lock files. flake.lock file so they do not pollute downstream projects' lock files.

View File

@ -187,7 +187,6 @@ install hooks.
Useful for caching incremental cargo builds. Useful for caching incremental cargo builds.
- Default value: the result of `buildDepsOnly` after applying the arguments - Default value: the result of `buildDepsOnly` after applying the arguments
set (with the respective default values). set (with the respective default values).
- `installCargoArtifactsMode` will be set to `"use-zstd"` if not specified.
- `installPhase` and `installPhaseCommand` will be removed, and no - `installPhase` and `installPhaseCommand` will be removed, and no
installation hooks will be run installation hooks will be run
* `cargoBuildCommand`: A cargo invocation to run during the derivation's build * `cargoBuildCommand`: A cargo invocation to run during the derivation's build
@ -257,7 +256,6 @@ Except where noted below, all derivation attributes are delegated to
set (with the respective default values). set (with the respective default values).
- `CARGO_BUILD_TARGET` will be set to `"wasm32-unknown-unknown"` if not specified. - `CARGO_BUILD_TARGET` will be set to `"wasm32-unknown-unknown"` if not specified.
- `doCheck` will be set to `false` if not specified. - `doCheck` will be set to `false` if not specified.
- `installCargoArtifactsMode` will be set to `"use-zstd"` if not specified.
- `installPhase` and `installPhaseCommand` will be removed (in favor of their - `installPhase` and `installPhaseCommand` will be removed (in favor of their
default values provided by `buildDepsOnly`) default values provided by `buildDepsOnly`)
* `installPhaseCommand`: the command(s) which are expected to install the * `installPhaseCommand`: the command(s) which are expected to install the
@ -1541,7 +1539,7 @@ arguments:
`./target`) will be used. `./target`) will be used.
1. the installation mode to apply 1. the installation mode to apply
* If specified, the value of `$installCargoArtifactsMode` will be used, * If specified, the value of `$installCargoArtifactsMode` will be used,
otherwise, a default value of `"use-symlink" will be used otherwise, a default value of `"use-zstd" will be used
* If set to "use-symlink" then `dedupAndInstallCargoArtifactsDir()` will be * If set to "use-symlink" then `dedupAndInstallCargoArtifactsDir()` will be
used. used.
- If `$cargoArtifacts` is defined and `$cargoArtifacts/target` is a valid - If `$cargoArtifacts` is defined and `$cargoArtifacts/target` is a valid

View File

@ -39,7 +39,6 @@ mkCargoDerivation (cleanedArgs // memoizedArgs // {
cargoArtifacts = args.cargoArtifacts or ( cargoArtifacts = args.cargoArtifacts or (
buildDepsOnly (args // memoizedArgs // { buildDepsOnly (args // memoizedArgs // {
installCargoArtifactsMode = args.installCargoArtifactsMode or "use-zstd";
# NB: we intentionally don't run any caller-provided hooks here since they might fail # NB: we intentionally don't run any caller-provided hooks here since they might fail
# if they require any files that have been omitted by the source dummification. # if they require any files that have been omitted by the source dummification.
# However, we still _do_ want to run the installation hook with the actual artifacts # However, we still _do_ want to run the installation hook with the actual artifacts

View File

@ -37,7 +37,6 @@ mkCargoDerivation (args // {
cargoArtifacts = args.cargoArtifacts or (buildDepsOnly (args // { cargoArtifacts = args.cargoArtifacts or (buildDepsOnly (args // {
CARGO_BUILD_TARGET = args.CARGO_BUILD_TARGET or "wasm32-unknown-unknown"; CARGO_BUILD_TARGET = args.CARGO_BUILD_TARGET or "wasm32-unknown-unknown";
installCargoArtifactsMode = args.installCargoArtifactsMode or "use-zstd";
doCheck = args.doCheck or false; doCheck = args.doCheck or false;
})); }));

View File

@ -76,7 +76,7 @@ prepareAndInstallCargoArtifactsDir() {
# or fall back to defaults if none are provided # or fall back to defaults if none are provided
local dir="${1:-${out}}" local dir="${1:-${out}}"
local cargoTargetDir="${2:-${CARGO_TARGET_DIR:-target}}" local cargoTargetDir="${2:-${CARGO_TARGET_DIR:-target}}"
local mode="${3:-${installCargoArtifactsMode:-use-symlink}}" local mode="${3:-${installCargoArtifactsMode:-use-zstd}}"
local prevCargoArtifacts="${4:-${cargoArtifacts:""}}" local prevCargoArtifacts="${4:-${cargoArtifacts:""}}"
mkdir -p "${dir}" mkdir -p "${dir}"