Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
cargo artifacts) can be achieved by setting `doCompressAndInstallFullArchive =
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)
flake.lock file so they do not pollute downstream projects' lock files.

Expand Down
4 changes: 1 addition & 3 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ install hooks.
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.
- `installPhase` and `installPhaseCommand` will be removed, and no
installation hooks will be run
* `cargoBuildCommand`: A cargo invocation to run during the derivation's build
Expand Down Expand Up @@ -257,7 +256,6 @@ Except where noted below, all derivation attributes are delegated to
set (with the respective default values).
- `CARGO_BUILD_TARGET` will be set to `"wasm32-unknown-unknown"` 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
default values provided by `buildDepsOnly`)
* `installPhaseCommand`: the command(s) which are expected to install the
Expand Down Expand Up @@ -1541,7 +1539,7 @@ arguments:
`./target`) will be used.
1. the installation mode to apply
* 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
used.
- If `$cargoArtifacts` is defined and `$cargoArtifacts/target` is a valid
Expand Down
1 change: 0 additions & 1 deletion lib/buildPackage.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ mkCargoDerivation (cleanedArgs // memoizedArgs // {

cargoArtifacts = args.cargoArtifacts or (
buildDepsOnly (args // memoizedArgs // {
installCargoArtifactsMode = args.installCargoArtifactsMode or "use-zstd";
# 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.
# However, we still _do_ want to run the installation hook with the actual artifacts
Expand Down
1 change: 0 additions & 1 deletion lib/buildTrunkPackage.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ mkCargoDerivation (args // {

cargoArtifacts = args.cargoArtifacts or (buildDepsOnly (args // {
CARGO_BUILD_TARGET = args.CARGO_BUILD_TARGET or "wasm32-unknown-unknown";
installCargoArtifactsMode = args.installCargoArtifactsMode or "use-zstd";
doCheck = args.doCheck or false;
}));

Expand Down
2 changes: 1 addition & 1 deletion lib/setupHooks/installCargoArtifactsHook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ prepareAndInstallCargoArtifactsDir() {
# or fall back to defaults if none are provided
local dir="${1:-${out}}"
local cargoTargetDir="${2:-${CARGO_TARGET_DIR:-target}}"
local mode="${3:-${installCargoArtifactsMode:-use-symlink}}"
local mode="${3:-${installCargoArtifactsMode:-use-zstd}}"
local prevCargoArtifacts="${4:-${cargoArtifacts:""}}"

mkdir -p "${dir}"
Expand Down