Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for this change
Even though
fetchzip
uses stdenv'sunpackFile
to unpack.{tar{,.*},zip}
files, it doesn't expose any convenient way to extend it to handle anything other than that.Additionally,
fetchzip
'sstripRoot
goes beyond ignoring archive metadata/algorithm non-determinism and affects actual archive contents.This is an attempt at a more explicit API that only fetches, then unpacks with one of
inputs
. It uses SRI hashes added in Nix 2.2 to avoid code churn that happens to algorithm-specific arg attrs as hash algorithms change.stripRoot
is implemented a la carte as a function that takes a directory and returns its first child.Short list of changes:
unpackCmd
hook todpkg
fetchurl
fetchArchive
+ docsfetchArchive
ontypora
derivationlib.stripRoot
+ docsFetch examples:
Derivation override example:
Maybe this should better be called
fetchThenUnpack
. Also, instead oflib.stripRoot
, stdenv can be tweaked into supporting non-stripped sources.cc @grahamc, @LnL7, @oxij, @zimbatm
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)