2024-05-04 23:15:57 +03:00
|
|
|
# Apple San Francisco and New York fonts.
|
|
|
|
# They are not available in Nixpkgs repo, so this script
|
|
|
|
# downloads the fonts from Apple website and adds them to Nix store.
|
2024-03-04 00:34:39 +03:00
|
|
|
{ lib, stdenv, fetchurl, p7zip }: let
|
|
|
|
pro = fetchurl {
|
|
|
|
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg";
|
2024-06-29 19:01:12 +03:00
|
|
|
sha256 = "sha256-B8xljBAqOoRFXvSOkOKDDWeYUebtMmQLJ8lF05iFnXk=";
|
2024-03-04 00:34:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
compact = fetchurl {
|
|
|
|
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg";
|
2024-06-29 19:01:12 +03:00
|
|
|
sha256 = "sha256-L4oLQ34Epw1/wLehU9sXQwUe/LaeKjHRxQAF6u2pfTo=";
|
2024-03-04 00:34:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
mono = fetchurl {
|
|
|
|
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg";
|
2024-06-29 19:01:12 +03:00
|
|
|
sha256 = "sha256-Uarx1TKO7g5yVBXAx6Yki065rz/wRuYiHPzzi6cTTl8=";
|
2024-03-04 00:34:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
ny = fetchurl {
|
|
|
|
url = "https://devimages-cdn.apple.com/design/resources/download/NY.dmg";
|
2024-06-29 19:01:12 +03:00
|
|
|
sha256 = "sha256-yYyqkox2x9nQ842laXCqA3UwOpUGyIfUuprX975OsLA=";
|
2024-03-04 00:34:39 +03:00
|
|
|
};
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
name = "applefont";
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ p7zip ];
|
|
|
|
|
|
|
|
installPhase = let
|
|
|
|
unpackFont = dmg: dir: pkg: ''
|
|
|
|
7z x '${dmg}'
|
|
|
|
pushd '${dir}'
|
|
|
|
7z x '${pkg}'
|
|
|
|
7z x 'Payload~'
|
|
|
|
cp Library/Fonts/* $TMPDIR
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
in ''
|
|
|
|
${unpackFont pro "SFProFonts" "SF Pro Fonts.pkg"}
|
|
|
|
${unpackFont mono "SFMonoFonts" "SF Mono Fonts.pkg"}
|
|
|
|
${unpackFont compact "SFCompactFonts" "SF Compact Fonts.pkg"}
|
|
|
|
${unpackFont ny "NYFonts" "NY Fonts.pkg"}
|
|
|
|
|
|
|
|
mkdir -p $out/usr/share/fonts/{TTF,OTF}
|
|
|
|
mv $TMPDIR/*.otf $out/usr/share/fonts/OTF
|
|
|
|
mv $TMPDIR/*.ttf $out/usr/share/fonts/TTF
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Apple San Francisco, New York fonts.";
|
|
|
|
homepage = "https://developer.apple.com/fonts";
|
2024-06-30 03:56:48 +03:00
|
|
|
license = licenses.mit;
|
2024-03-04 00:34:39 +03:00
|
|
|
meta.platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|