+150
-10
doc/build-helpers/fetchers.chapter.md
+150
-10
doc/build-helpers/fetchers.chapter.md
···: If set to `true`, will signal to Nix that the hash given to `fetchurl` was calculated using the `"recursive"` mode.See [the documentation on the Nix manual](https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-outputHashMode) for more information about the existing modes.···: If `true`, saves the downloaded file to a temporary location instead of the expected Nix store location.This is useful when used in conjunction with `postFetch` attribute, otherwise `fetchurl` will not produce any meaningful output.···-Downloads content from a given URL (which is assumed to be an archive), and decompresses the archive for you, making files and directories directly accessible.-Despite its name, `fetchzip` is not limited to `.zip` files and can also be used with any tarball.+Returns a [fixed-output derivation](https://nixos.org/manual/nix/stable/glossary.html#gloss-fixed-output-derivation) which downloads an archive from a given URL and decompresses it.+Despite its name, `fetchzip` is not limited to `.zip` files but can also be used with [various compressed tarball formats](#tar-files) by default.+This can extended by specifying additional attributes, see [](#ex-fetchers-fetchzip-rar-archive) to understand how to do that.+`fetchzip` requires an attribute set, and most attributes are passed to the underlying call to [`fetchurl`](#sec-pkgs-fetchers-fetchurl).+The attributes below are treated differently by `fetchzip` when compared to what `fetchurl` expects:+: Works as defined in `fetchurl`, but it is also augmented by `fetchzip` to include packages to deal with additional archives (such as `.zip`).+: Works as defined in `fetchurl`, but it is also augmented with the code needed to make `fetchzip` work.+This is useful for archives that decompress into a single directory which commonly includes some values that change with time, such as version numbers.+When this is the case (and `stripRoot` is `true`), `fetchzip` will remove this directory and make the decompressed contents available in the top-level directory.+: If set, the archive downloaded by `fetchzip` will be renamed to a filename with the extension specified in this attribute.+This is useful when making `fetchzip` support additional types of archives, because the implementation may use the extension of an archive to determine whether they can decompress it.+If the URL you're using to download the contents doesn't end with the extension associated with the archive, use this attribute to fix the filename of the archive.+: Works [as defined in `fetchurl`](#sec-pkgs-fetchers-fetchurl-inputs-recursiveHash), but its default value is different than for `fetchurl`.+: Works [as defined in `fetchurl`](#sec-pkgs-fetchers-fetchurl-inputs-downloadToTemp), but its default value is different than for `fetchurl`.···+This means that after decompressing, you'd have to enter this directory to see the contents of the archive.+After building the recipe, the derivation output will show all the files in the archive at the top level:+If `stripRoot` is set to `false`, the derivation output will be the decompressed archive as-is:+Whenever changing attributes of a Nixpkgs fetcher, [remember to invalidate the hash](#chap-pkgs-fetchers-caveats), otherwise you won't get the results you're expecting!+The `unrar` package provides a [setup hook](#ssec-setup-hooks) to decompress `.rar` archives during the [unpack phase](#ssec-unpack-phase), which can be used with `fetchzip` to decompress those archives:+Since this particular `.rar` file doesn't put its contents in a directory inside the archive, `stripRoot` must be set to `false`.