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-10-11 23:27:07 +03:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchurl,
|
|
|
|
p7zip,
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
pro = fetchurl {
|
|
|
|
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg";
|
2024-10-12 02:30:50 +03:00
|
|
|
sha256 = "1krvzxz7kal6y0l5cx9svmgikqdj5v0fl5vnfjig0z4nwp903ir1";
|
2024-10-11 23:27:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
compact = fetchurl {
|
|
|
|
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg";
|
2024-10-12 02:30:50 +03:00
|
|
|
sha256 = "0ncybkrzqazw13azy2s30ss7ml5pxaia6hbmqq9wn7xhlhrxlniy";
|
2024-10-11 23:27:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
mono = fetchurl {
|
|
|
|
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg";
|
2024-10-12 02:30:50 +03:00
|
|
|
sha256 = "0ibrk9fvbq52f5qnv1a8xlsazd3x3jnwwhpn2gwhdkdawdw0njkd";
|
2024-10-11 23:27:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
ny = fetchurl {
|
|
|
|
url = "https://devimages-cdn.apple.com/design/resources/download/NY.dmg";
|
2024-10-12 02:30:50 +03:00
|
|
|
sha256 = "1x7qi3dqwq1p4l3md31cd93mcds3ba7rgsmpz0kg7h3caasfsbhw";
|
2024-10-11 23:27:07 +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";
|
|
|
|
license = licenses.mit;
|
|
|
|
meta.platforms = platforms.all;
|
|
|
|
};
|
2024-03-04 00:34:39 +03:00
|
|
|
}
|