summary refs log tree commit diff
path: root/pkgs/data/fonts/source-sans-pro
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-01-28 09:08:17 +0100
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2023-01-28 09:08:17 +0100
commit7562d1ed9cacaeddc46a8fc26c9e340569cea1ac (patch)
treeb135589bcf1b4c2692d66c76c827c51bf92dd985 /pkgs/data/fonts/source-sans-pro
parent4fe4a0e8abadd05d9e81923c13531ab1476d6fd3 (diff)
downloadnixpkgs-7562d1ed9cacaeddc46a8fc26c9e340569cea1ac.tar
nixpkgs-7562d1ed9cacaeddc46a8fc26c9e340569cea1ac.tar.gz
nixpkgs-7562d1ed9cacaeddc46a8fc26c9e340569cea1ac.tar.bz2
nixpkgs-7562d1ed9cacaeddc46a8fc26c9e340569cea1ac.tar.lz
nixpkgs-7562d1ed9cacaeddc46a8fc26c9e340569cea1ac.tar.xz
nixpkgs-7562d1ed9cacaeddc46a8fc26c9e340569cea1ac.tar.zst
nixpkgs-7562d1ed9cacaeddc46a8fc26c9e340569cea1ac.zip
treewide: convert 9 fonts to stdenvNoCC.mkDerivation
Diffstat (limited to 'pkgs/data/fonts/source-sans-pro')
-rw-r--r--pkgs/data/fonts/source-sans-pro/default.nix33
1 files changed, 18 insertions, 15 deletions
diff --git a/pkgs/data/fonts/source-sans-pro/default.nix b/pkgs/data/fonts/source-sans-pro/default.nix
index 382c20aa976..2a2d2c70f28 100644
--- a/pkgs/data/fonts/source-sans-pro/default.nix
+++ b/pkgs/data/fonts/source-sans-pro/default.nix
@@ -1,18 +1,28 @@
-# when changing this expression convert it from 'fetchzip' to 'stdenvNoCC.mkDerivation'
-{ lib, fetchzip }:
+{ lib, stdenvNoCC, fetchzip }:
 
 # Source Sans Pro got renamed to Source Sans 3 (see
 # https://github.com/adobe-fonts/source-sans/issues/192). This is the
 # last version named "Pro". It is useful for backward compatibility
 # with older documents/templates/etc.
-let
-  version = "3.006";
-in (fetchzip {
+
+stdenvNoCC.mkDerivation rec {
   name = "source-sans-pro-${version}";
+  version = "3.006";
+
+  src = fetchzip {
+    url = "https://github.com/adobe-fonts/source-sans/archive/${version}R.zip";
+    hash = "sha256-1Savijgq3INuUN89MR0t748HOuGseXVw5Kd4hYwuVas=";
+  };
+
+  installPhase = ''
+    runHook preInstall
 
-  url = "https://github.com/adobe-fonts/source-sans/archive/${version}R.zip";
+    install -Dm444 OTF/*.otf -t $out/share/fonts/opentype
+    install -Dm444 TTF/*.ttf -t $out/share/fonts/truetype
+    install -Dm444 VAR/*.otf -t $out/share/fonts/variable
 
-  sha256 = "sha256-uWr/dFyLF65v0o6+oN/3RQoe4ziPspzGB1rgiBkoTYY=";
+    runHook postInstall
+  '';
 
   meta = with lib; {
     homepage = "https://adobe-fonts.github.io/source-sans/";
@@ -21,11 +31,4 @@ in (fetchzip {
     platforms = platforms.all;
     maintainers = with maintainers; [ ttuegel ];
   };
-}).overrideAttrs (_: {
-  postFetch = ''
-    mkdir -p $out/share/fonts/{opentype,truetype,variable}
-    unzip -j $downloadedFile "*/OTF/*.otf" -d $out/share/fonts/opentype
-    unzip -j $downloadedFile "*/TTF/*.ttf" -d $out/share/fonts/truetype
-    unzip -j $downloadedFile "*/VAR/*.otf" -d $out/share/fonts/variable
-  '';
-})
+}