nix-prefetch-url
copy a file from a URL into the store and print its MD5 hash
nix-prefetch-url
url
Description
The command nix-prefetch-url downloads the
file referenced by the URL url,
prints its MD5 cryptographic hash code, and copies it into the
Nix store. The file name in the store is
hash-basename,
where basename is everything
following the final slash in url.
This command is just a convenience to Nix expression writers.
Often a Nix expressions fetch some source distribution from the
network using the fetchurl expression
contained in nixpkgs. However,
fetchurl requires an MD5 hash. If you don't
know the hash, you would have to download the file first, and
then fetchurl would download it again when
you build your Nix expression. Since
fetchurl uses the same name for the
downloaded file as nix-prefetch-url, the
redundant download can be avoided.
Examples
$ nix-prefetch-url ftp://ftp.nluug.nl/pub/gnu/make/make-3.80.tar.bz2
...
file has hash 0bbd1df101bc0294d440471e50feca71
...