diff options
author | emilylange <git@emilylange.de> | 2023-10-25 23:56:55 +0200 |
---|---|---|
committer | emilylange <git@emilylange.de> | 2023-10-31 16:14:08 +0100 |
commit | 80627bfe8ff3a42161597bea24a257e78ff94b94 (patch) | |
tree | 9c41db51f9539d7dd58e7ea7ebedbfdcc0800caf /pkgs/stdenv/generic | |
parent | 6c5458cf32ba8aff7db0fc15379ba375f944067b (diff) | |
download | nixlib-80627bfe8ff3a42161597bea24a257e78ff94b94.tar nixlib-80627bfe8ff3a42161597bea24a257e78ff94b94.tar.gz nixlib-80627bfe8ff3a42161597bea24a257e78ff94b94.tar.bz2 nixlib-80627bfe8ff3a42161597bea24a257e78ff94b94.tar.lz nixlib-80627bfe8ff3a42161597bea24a257e78ff94b94.tar.xz nixlib-80627bfe8ff3a42161597bea24a257e78ff94b94.tar.zst nixlib-80627bfe8ff3a42161597bea24a257e78ff94b94.zip |
stdenv: enable multithreading for `xz` decompression
(only if the implementation supports it) This speeds up the decompression of huge tar.xz tarballs (e.g. chromium) on high core count systems.
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index ad9857fc9d61..4a8e434745c1 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1057,7 +1057,11 @@ _defaultUnpack() { case "$fn" in *.tar.xz | *.tar.lzma | *.txz) # Don't rely on tar knowing about .xz. - xz -d < "$fn" | tar xf - --warning=no-timestamp + # Additionally, we have multiple different xz binaries with different feature sets in different + # stages. The XZ_OPT env var is only used by the full "XZ utils" implementation, which supports + # the --threads (-T) flag. This allows us to enable multithreaded decompression exclusively on + # that implementation, without the use of complex bash conditionals and checks. + XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn" | tar xf - --warning=no-timestamp ;; *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) # GNU tar can automatically select the decompression method |