fixed-output derivations
A fixed-output derivation is one whose cryptographic hash is known ahead of time.
The derivations generated by fetchurl
and related Nix functions are fixed-output derivations. This allows for source tarballs and similar files to be downloaded to the Nix storeᛦ without breaking every dependent when a source mirror or other metadata gets updated.
The store path is determined entirely by the hash of the name
and outputHash*
attributes, rather than by the hash of all Components of a Nix derivationᛦ.
When writing derivations this way, use
outputHashMode
- one of"flat"
(a hash of the file) or"recursive"
(a hash of the NAR archiveᛦ dump of the source)outputHashAlgo
- one ofsha1
,sha256
, orsha512
outputHash
- the actual result hash, either in hexadecimal or base-32
fetchurl
uses "flat"
and sha256
.