diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index a85d53adb829..28d2519f4232 100644 --- a/pkgs/build-support/fetchurl/default.nix +++ b/pkgs/build-support/fetchurl/default.nix @@ -57,6 +57,10 @@ in # first element of `urls'). name ? "" + # for versioned downloads optionally take pname + version. +, pname ? "" +, version ? "" + , # SRI hash. hash ? "" @@ -130,12 +134,16 @@ let else throw "fetchurl requires a hash for fixed-output derivation: ${lib.concatStringsSep ", " urls_}"; in -stdenvNoCC.mkDerivation { - name = - if showURLs then "urls" - else if name != "" then name - else baseNameOf (toString (builtins.head urls_)); - +stdenvNoCC.mkDerivation (( + if (pname != "" && version != "") then + { inherit pname version; } + else + { name = + if showURLs then "urls" + else if name != "" then name + else baseNameOf (toString (builtins.head urls_)); + } +) // { builder = ./builder.sh; nativeBuildInputs = [ curl ] ++ nativeBuildInputs; @@ -177,4 +185,4 @@ stdenvNoCC.mkDerivation { inherit meta; passthru = { inherit url; } // passthru; -} +}) diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix index 10142134792f..9c08276cdb9b 100644 --- a/pkgs/build-support/fetchzip/default.nix +++ b/pkgs/build-support/fetchzip/default.nix @@ -14,6 +14,8 @@ , extraPostFetch ? "" , postFetch ? "" , name ? "source" +, pname ? "" +, version ? "" , nativeBuildInputs ? [ ] , # Allows to set the extension for the intermediate downloaded # file. This can be used as a hint for the unpackCmdHooks to select @@ -23,14 +25,23 @@ lib.warnIf (extraPostFetch != "") "use 'postFetch' instead of 'extraPostFetch' with 'fetchzip' and 'fetchFromGitHub'." -(fetchurl (let + +(let tmpFilename = if extension != null then "download.${extension}" else baseNameOf (if url != "" then url else builtins.head urls); -in { - inherit name; +in +fetchurl (( + if (pname != "" && version != "") then + { + name = "${name}-${version}"; + inherit pname version; + } + else + { inherit name; } +) // { recursiveHash = true; downloadToTemp = true; diff --git a/pkgs/data/fonts/cooper-hewitt/default.nix b/pkgs/data/fonts/cooper-hewitt/default.nix index 19c68973a252..48c7bc873428 100644 --- a/pkgs/data/fonts/cooper-hewitt/default.nix +++ b/pkgs/data/fonts/cooper-hewitt/default.nix @@ -1,21 +1,19 @@ -{ lib, stdenv, fetchzip }: +{ lib, fetchzip }: -stdenv.mkDerivation { +fetchzip rec { pname = "cooper-hewitt"; version = "unstable-2014-06-09"; - src = fetchzip { - url = "https://www.cooperhewitt.org/wp-content/uploads/fonts/CooperHewitt-OTF-public.zip"; - hash = "sha256-bTlEXQeYNNspvnNdvQhJn6CNBrcSKYWuNWF/N6+3Vb0="; - }; + url = "https://web.archive.org/web/20221004145117/https://www.cooperhewitt.org/wp-content/uploads/fonts/CooperHewitt-OTF-public.zip"; - dontConfigure = true; - dontBuild = true; - - installPhase = '' - install -D -m 644 -t "$out/share/fonts/opentype" *.otf + postFetch = '' + mkdir -p $out/share/fonts/opentype + mv $out/*.otf $out/share/fonts/opentype + find $out -maxdepth 1 ! -type d -exec rm {} + ''; + sha256 = "01iwqmjvqkc6fmc2r0486vk06s6f51n9wxzl1pf9z48n0igj4gqd"; + meta = with lib; { homepage = "https://www.cooperhewitt.org/open-source-at-cooper-hewitt/cooper-hewitt-the-typeface-by-chester-jenkins/"; description = "A contemporary sans serif, with characters composed of modified-geometric curves and arches"; diff --git a/pkgs/data/fonts/freefont-ttf/default.nix b/pkgs/data/fonts/freefont-ttf/default.nix index 5934ec3589ac..9d8c28681a9f 100644 --- a/pkgs/data/fonts/freefont-ttf/default.nix +++ b/pkgs/data/fonts/freefont-ttf/default.nix @@ -1,16 +1,18 @@ { lib, fetchzip }: fetchzip rec { - name = "freefont-ttf-20120503"; + pname = "freefont-ttf"; + version = "20120503"; - url = "mirror://gnu/freefont/${name}.zip"; + url = "mirror://gnu/freefont/freefont-ttf-${version}.zip"; postFetch = '' - mkdir -p $out/share/fonts - unzip -j $downloadedFile \*.ttf -d $out/share/fonts/truetype + mkdir -p $out/share/fonts/truetype + mv $out/*.ttf $out/share/fonts/truetype + find $out -maxdepth 1 ! -type d -exec rm {} + ''; - sha256 = "0h0x2hhr7kvjiycf7fv800xxwa6hcpiz54bqx06wsqc7z61iklvd"; + sha256 = "sha256-bdMZg/mHYc0N6HiR8uNl0CjeOwBou+OYj3LPkyEUHUA="; meta = { description = "GNU Free UCS Outline Fonts"; diff --git a/pkgs/data/fonts/ubuntu-font-family/default.nix b/pkgs/data/fonts/ubuntu-font-family/default.nix index 4e29f23a158d..0458abf91d4f 100644 --- a/pkgs/data/fonts/ubuntu-font-family/default.nix +++ b/pkgs/data/fonts/ubuntu-font-family/default.nix @@ -1,20 +1,18 @@ -{ lib, stdenv, fetchzip }: +{ lib, fetchzip }: -stdenv.mkDerivation rec { +fetchzip rec { pname = "ubuntu-font-family"; version = "0.83"; - src = fetchzip { - url = "https://assets.ubuntu.com/v1/fad7939b-${pname}-${version}.zip"; - hash = "sha256-FAg1xn8Gcbwmuvqtg9SquSet4oTT9nqE+Izeq7ZMVcA="; - }; + url = "https://assets.ubuntu.com/v1/fad7939b-ubuntu-font-family-${version}.zip"; - installPhase = '' - install -D -m 644 -t "$out/share/fonts/truetype" *.ttf + postFetch = '' + mkdir -p $out/share/fonts/ubuntu + mv $out/*.ttf $out/share/fonts/ubuntu + find $out -maxdepth 1 ! -type d -exec rm {} + ''; - outputHashMode = "recursive"; - outputHash = "sha256-EEcYtOeOd2DKyRLo1kG7lk8euaFilCFMXMJNAosxHiQ="; + sha256 = "090y665h4kf2bi623532l6wiwkwnpd0xds0jr7560xwfwys1hiqh"; meta = with lib; { description = "Ubuntu Font Family"; @@ -25,6 +23,6 @@ stdenv.mkDerivation rec { homepage = "http://font.ubuntu.com/"; license = licenses.free; platforms = platforms.all; - maintainers = with maintainers; [ antono ]; + maintainers = [ maintainers.antono ]; }; }