Applefont : Format.

This commit is contained in:
Dmitry Voronin 2024-02-25 22:42:25 +03:00
parent c40c9115d7
commit 002ab52c75

View file

@ -1,76 +1,75 @@
{ {
description = "Apple fonts."; description = "Apple fonts.";
outputs = { nixpkgs, system } @inputs: outputs = { nixpkgs, system } @inputs: let
let pkgs = nixpkgs.legacyPackages.${system};
pkgs = nixpkgs.legacyPackages.${system}; lib = nixpkgs.lib;
lib = nixpkgs.lib; in {
in { packages.${system}.default = pkgs.stdenv.mkDerivation rec {
packages.${system}.default = pkgs.stdenv.mkDerivation rec { pname = "applefonts";
pname = "applefonts"; version = "1";
version = "1";
pro = pkgs.fetchurl { pro = pkgs.fetchurl {
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg"; url = "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg";
sha256 = "sha256-Mu0pmx3OWiKBmMEYLNg+u2MxFERK07BQGe3WAhEec5Q="; sha256 = "sha256-Mu0pmx3OWiKBmMEYLNg+u2MxFERK07BQGe3WAhEec5Q=";
}; };
compact = pkgs.fetchurl { compact = pkgs.fetchurl {
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg"; url = "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg";
sha256 = "sha256-Mkf+GK4iuUhZdUdzMW0VUOmXcXcISejhMeZVm0uaRwY="; sha256 = "sha256-Mkf+GK4iuUhZdUdzMW0VUOmXcXcISejhMeZVm0uaRwY=";
}; };
mono = pkgs.fetchurl { mono = pkgs.fetchurl {
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg"; url = "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg";
sha256 = "sha256-tZHV6g427zqYzrNf3wCwiCh5Vjo8PAai9uEvayYPsjM="; sha256 = "sha256-tZHV6g427zqYzrNf3wCwiCh5Vjo8PAai9uEvayYPsjM=";
}; };
ny = pkgs.fetchurl { ny = pkgs.fetchurl {
url = "https://devimages-cdn.apple.com/design/resources/download/NY.dmg"; url = "https://devimages-cdn.apple.com/design/resources/download/NY.dmg";
sha256 = "sha256-tn1QLCSjgo5q4PwE/we80pJavr3nHVgFWrZ8cp29qBk="; sha256 = "sha256-tn1QLCSjgo5q4PwE/we80pJavr3nHVgFWrZ8cp29qBk=";
}; };
nativeBuildInputs = with pkgs; [ p7zip ]; nativeBuildInputs = with pkgs; [ p7zip ];
sourceRoot = "."; sourceRoot = ".";
dontUnpack = true; dontUnpack = true;
installPhase = '' installPhase = ''
7z x ${pro} 7z x ${pro}
cd SFProFonts cd SFProFonts
7z x 'SF Pro Fonts.pkg' 7z x 'SF Pro Fonts.pkg'
7z x 'Payload~' 7z x 'Payload~'
mkdir -p $out/fontfiles mkdir -p $out/fontfiles
mv Library/Fonts/* $out/fontfiles mv Library/Fonts/* $out/fontfiles
cd .. cd ..
7z x ${mono} 7z x ${mono}
cd SFMonoFonts cd SFMonoFonts
7z x 'SF Mono Fonts.pkg' 7z x 'SF Mono Fonts.pkg'
7z x 'Payload~' 7z x 'Payload~'
mv Library/Fonts/* $out/fontfiles mv Library/Fonts/* $out/fontfiles
cd .. cd ..
7z x ${compact} 7z x ${compact}
cd SFCompactFonts cd SFCompactFonts
7z x 'SF Compact Fonts.pkg' 7z x 'SF Compact Fonts.pkg'
7z x 'Payload~' 7z x 'Payload~'
mv Library/Fonts/* $out/fontfiles mv Library/Fonts/* $out/fontfiles
cd .. cd ..
7z x ${ny} 7z x ${ny}
cd NYFonts cd NYFonts
7z x 'NY Fonts.pkg' 7z x 'NY Fonts.pkg'
7z x 'Payload~' 7z x 'Payload~'
mv Library/Fonts/* $out/fontfiles mv Library/Fonts/* $out/fontfiles
mkdir -p $out/usr/share/fonts/OTF $out/usr/share/fonts/TTF mkdir -p $out/usr/share/fonts/OTF $out/usr/share/fonts/TTF
mv $out/fontfiles/*.otf $out/usr/share/fonts/OTF mv $out/fontfiles/*.otf $out/usr/share/fonts/OTF
mv $out/fontfiles/*.ttf $out/usr/share/fonts/TTF mv $out/fontfiles/*.ttf $out/usr/share/fonts/TTF
rm -rf $out/fontfiles rm -rf $out/fontfiles
''; '';
meta = { meta = {
description = "Apple San Francisco, New York fonts."; description = "Apple San Francisco, New York fonts.";
homepage = "https://developer.apple.com/fonts/"; homepage = "https://developer.apple.com/fonts/";
};
}; };
}; };
};
} }