Docs: update fixed output hashes
`fetchurl` will now throw if given an `md5`, and the hashes have generally been upgraded to avoid it and use `sha256` as a default. This updates the documentation examples in the manual accordingly.
This commit is contained in:
		
							parent
							
								
									d93db0ace0
								
							
						
					
					
						commit
						65453e2d77
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -216,7 +216,7 @@ fetchurl {
 | 
			
		|||
<programlisting>
 | 
			
		||||
{ stdenv, curl }: # The <command>curl</command> program is used for downloading.
 | 
			
		||||
 | 
			
		||||
{ url, md5 }:
 | 
			
		||||
{ url, sha256 }:
 | 
			
		||||
 | 
			
		||||
stdenv.mkDerivation {
 | 
			
		||||
  name = baseNameOf (toString url);
 | 
			
		||||
| 
						 | 
				
			
			@ -224,10 +224,10 @@ stdenv.mkDerivation {
 | 
			
		|||
  buildInputs = [ curl ];
 | 
			
		||||
 | 
			
		||||
  # This is a fixed-output derivation; the output must be a regular
 | 
			
		||||
  # file with MD5 hash <varname>md5</varname>.
 | 
			
		||||
  # file with SHA256 hash <varname>sha256</varname>.
 | 
			
		||||
  outputHashMode = "flat";
 | 
			
		||||
  outputHashAlgo = "md5";
 | 
			
		||||
  outputHash = md5;
 | 
			
		||||
  outputHashAlgo = "sha256";
 | 
			
		||||
  outputHash = sha256;
 | 
			
		||||
 | 
			
		||||
  inherit url;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -237,8 +237,8 @@ stdenv.mkDerivation {
 | 
			
		|||
 | 
			
		||||
    <para>The <varname>outputHashAlgo</varname> attribute specifies
 | 
			
		||||
    the hash algorithm used to compute the hash.  It can currently be
 | 
			
		||||
    <literal>"md5"</literal>, <literal>"sha1"</literal> or
 | 
			
		||||
    <literal>"sha256"</literal>.</para>
 | 
			
		||||
    <literal>"sha1"</literal>, <literal>"sha256"</literal> or
 | 
			
		||||
    <literal>"sha512"</literal>.</para>
 | 
			
		||||
 | 
			
		||||
    <para>The <varname>outputHashMode</varname> attribute determines
 | 
			
		||||
    how the hash is computed.  It must be one of the following two
 | 
			
		||||
| 
						 | 
				
			
			@ -251,7 +251,7 @@ stdenv.mkDerivation {
 | 
			
		|||
        <listitem><para>The output must be a non-executable regular
 | 
			
		||||
        file.  If it isn’t, the build fails.  The hash is simply
 | 
			
		||||
        computed over the contents of that file (so it’s equal to what
 | 
			
		||||
        Unix commands like <command>md5sum</command> or
 | 
			
		||||
        Unix commands like <command>sha256sum</command> or
 | 
			
		||||
        <command>sha1sum</command> produce).</para>
 | 
			
		||||
 | 
			
		||||
        <para>This is the default.</para></listitem>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue