From a4f81e1dbbb919edcaae495405a4969495a4b74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 4 Oct 2022 15:52:09 +0200 Subject: [PATCH 1/8] Revert "ubuntu-font-family: use mkDerivation" This reverts commit 73e9cb6a78edb3e2d6c460688554e8afcad61d32. --- .../data/fonts/ubuntu-font-family/default.nix | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/pkgs/data/fonts/ubuntu-font-family/default.nix b/pkgs/data/fonts/ubuntu-font-family/default.nix index 4e29f23a158d6..0f1d5b5a4cc03 100644 --- a/pkgs/data/fonts/ubuntu-font-family/default.nix +++ b/pkgs/data/fonts/ubuntu-font-family/default.nix @@ -1,30 +1,26 @@ -{ lib, stdenv, fetchzip }: +{ lib, fetchzip }: -stdenv.mkDerivation rec { - pname = "ubuntu-font-family"; - version = "0.83"; +fetchzip { + name = "ubuntu-font-family-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-0.83.zip"; - installPhase = '' - install -D -m 644 -t "$out/share/fonts/truetype" *.ttf + postFetch = '' + mkdir -p $out/share/fonts + unzip -j $downloadedFile \*.ttf -d $out/share/fonts/ubuntu ''; - outputHashMode = "recursive"; - outputHash = "sha256-EEcYtOeOd2DKyRLo1kG7lk8euaFilCFMXMJNAosxHiQ="; + sha256 = "090y665h4kf2bi623532l6wiwkwnpd0xds0jr7560xwfwys1hiqh"; - meta = with lib; { + meta = { description = "Ubuntu Font Family"; longDescription = "The Ubuntu typeface has been specially created to complement the Ubuntu tone of voice. It has a contemporary style and contains characteristics unique to the Ubuntu brand that convey a precise, reliable and free attitude."; homepage = "http://font.ubuntu.com/"; - license = licenses.free; - platforms = platforms.all; - maintainers = with maintainers; [ antono ]; + license = lib.licenses.free; + platforms = lib.platforms.all; + maintainers = [ lib.maintainers.antono ]; }; } From fc95752d6f7edd65d443c9dd5fd28b4a7b54cf4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 4 Oct 2022 16:49:08 +0200 Subject: [PATCH 2/8] Revert "cooper-hewitt: use mkDerivation" This reverts commit 9debb9217892cca73acc61232f6116fa4da6b045. --- pkgs/data/fonts/cooper-hewitt/default.nix | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/pkgs/data/fonts/cooper-hewitt/default.nix b/pkgs/data/fonts/cooper-hewitt/default.nix index 19c68973a2528..8783b1121738a 100644 --- a/pkgs/data/fonts/cooper-hewitt/default.nix +++ b/pkgs/data/fonts/cooper-hewitt/default.nix @@ -1,21 +1,17 @@ -{ lib, stdenv, fetchzip }: +{ lib, fetchzip }: -stdenv.mkDerivation { - pname = "cooper-hewitt"; - version = "unstable-2014-06-09"; +fetchzip { + name = "cooper-hewitt-2014-06-09"; - src = fetchzip { - url = "https://www.cooperhewitt.org/wp-content/uploads/fonts/CooperHewitt-OTF-public.zip"; - hash = "sha256-bTlEXQeYNNspvnNdvQhJn6CNBrcSKYWuNWF/N6+3Vb0="; - }; - - dontConfigure = true; - dontBuild = true; + url = "https://www.cooperhewitt.org/wp-content/uploads/fonts/CooperHewitt-OTF-public.zip"; - installPhase = '' - install -D -m 644 -t "$out/share/fonts/opentype" *.otf + postFetch = '' + mkdir -p $out/share/fonts/opentype + unzip -j $downloadedFile \*.otf -d $out/share/fonts/opentype/ ''; + 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"; From 7deac8b8f703702d8ec68490dc2be2301696be8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 4 Oct 2022 17:30:06 +0200 Subject: [PATCH 3/8] fetchurl: add pname+version support --- pkgs/build-support/fetchurl/default.nix | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index a85d53adb8292..72cfd20652b45 100644 --- a/pkgs/build-support/fetchurl/default.nix +++ b/pkgs/build-support/fetchurl/default.nix @@ -57,6 +57,11 @@ in # first element of `urls'). name ? "" + # for versioned downloads optionally take pname + version. + # if name is set that is preferred +, pname ? "" +, version ? "" + , # SRI hash. hash ? "" @@ -130,12 +135,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 +186,4 @@ stdenvNoCC.mkDerivation { inherit meta; passthru = { inherit url; } // passthru; -} +}) From 01dfd3cb5827a190e90c2627f4a1714b9deda4af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 4 Oct 2022 17:30:18 +0200 Subject: [PATCH 4/8] fetchzip: add pname+version support --- pkgs/build-support/fetchzip/default.nix | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix index 10142134792f5..9c08276cdb9b5 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; From 50922fe9fdee27cc95daf01416bfa7defe876e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 4 Oct 2022 18:50:41 +0200 Subject: [PATCH 5/8] cooper-hewitt: switch to pname+version, fix build --- pkgs/data/fonts/cooper-hewitt/default.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/data/fonts/cooper-hewitt/default.nix b/pkgs/data/fonts/cooper-hewitt/default.nix index 8783b1121738a..48c7bc8734283 100644 --- a/pkgs/data/fonts/cooper-hewitt/default.nix +++ b/pkgs/data/fonts/cooper-hewitt/default.nix @@ -1,13 +1,15 @@ { lib, fetchzip }: -fetchzip { - name = "cooper-hewitt-2014-06-09"; +fetchzip rec { + pname = "cooper-hewitt"; + version = "unstable-2014-06-09"; - url = "https://www.cooperhewitt.org/wp-content/uploads/fonts/CooperHewitt-OTF-public.zip"; + url = "https://web.archive.org/web/20221004145117/https://www.cooperhewitt.org/wp-content/uploads/fonts/CooperHewitt-OTF-public.zip"; postFetch = '' mkdir -p $out/share/fonts/opentype - unzip -j $downloadedFile \*.otf -d $out/share/fonts/opentype/ + mv $out/*.otf $out/share/fonts/opentype + find $out -maxdepth 1 ! -type d -exec rm {} + ''; sha256 = "01iwqmjvqkc6fmc2r0486vk06s6f51n9wxzl1pf9z48n0igj4gqd"; From e500cba3982b24254da246bd4c79c99ff1242253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 4 Oct 2022 18:54:24 +0200 Subject: [PATCH 6/8] freefont-ttf: switch to pname+version, fix build --- pkgs/data/fonts/freefont-ttf/default.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/data/fonts/freefont-ttf/default.nix b/pkgs/data/fonts/freefont-ttf/default.nix index 5934ec3589ac3..9d8c28681a9f1 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"; From fdd0db3a4da4ea6429315b22b29e8d2d3727649a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Tue, 4 Oct 2022 18:55:53 +0200 Subject: [PATCH 7/8] ubuntu-font-family: switch to pname+version, fix build --- .../data/fonts/ubuntu-font-family/default.nix | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkgs/data/fonts/ubuntu-font-family/default.nix b/pkgs/data/fonts/ubuntu-font-family/default.nix index 0f1d5b5a4cc03..0458abf91d4f9 100644 --- a/pkgs/data/fonts/ubuntu-font-family/default.nix +++ b/pkgs/data/fonts/ubuntu-font-family/default.nix @@ -1,26 +1,28 @@ { lib, fetchzip }: -fetchzip { - name = "ubuntu-font-family-0.83"; +fetchzip rec { + pname = "ubuntu-font-family"; + version = "0.83"; - url = "https://assets.ubuntu.com/v1/fad7939b-ubuntu-font-family-0.83.zip"; + url = "https://assets.ubuntu.com/v1/fad7939b-ubuntu-font-family-${version}.zip"; postFetch = '' - mkdir -p $out/share/fonts - unzip -j $downloadedFile \*.ttf -d $out/share/fonts/ubuntu + mkdir -p $out/share/fonts/ubuntu + mv $out/*.ttf $out/share/fonts/ubuntu + find $out -maxdepth 1 ! -type d -exec rm {} + ''; sha256 = "090y665h4kf2bi623532l6wiwkwnpd0xds0jr7560xwfwys1hiqh"; - meta = { + meta = with lib; { description = "Ubuntu Font Family"; longDescription = "The Ubuntu typeface has been specially created to complement the Ubuntu tone of voice. It has a contemporary style and contains characteristics unique to the Ubuntu brand that convey a precise, reliable and free attitude."; homepage = "http://font.ubuntu.com/"; - license = lib.licenses.free; - platforms = lib.platforms.all; - maintainers = [ lib.maintainers.antono ]; + license = licenses.free; + platforms = platforms.all; + maintainers = [ maintainers.antono ]; }; } From 1fd6cf192a849c3ef9886ea34f7803991e8b127d Mon Sep 17 00:00:00 2001 From: Sandro Date: Wed, 5 Oct 2022 15:54:57 +0200 Subject: [PATCH 8/8] fixup! fetchurl: add pname+version support --- pkgs/build-support/fetchurl/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index 72cfd20652b45..28d2519f4232c 100644 --- a/pkgs/build-support/fetchurl/default.nix +++ b/pkgs/build-support/fetchurl/default.nix @@ -58,7 +58,6 @@ in name ? "" # for versioned downloads optionally take pname + version. - # if name is set that is preferred , pname ? "" , version ? ""