Applefont : From flake to callPackage, thanks to Лиса.
This commit is contained in:
parent
364d33c847
commit
4f4e21a26d
|
@ -1,75 +0,0 @@
|
||||||
{
|
|
||||||
description = "Apple fonts.";
|
|
||||||
|
|
||||||
outputs = { nixpkgs, system } @inputs: let
|
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
|
||||||
lib = nixpkgs.lib;
|
|
||||||
in {
|
|
||||||
packages.${system}.default = pkgs.stdenv.mkDerivation rec {
|
|
||||||
pname = "applefonts";
|
|
||||||
version = "1";
|
|
||||||
|
|
||||||
pro = pkgs.fetchurl {
|
|
||||||
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg";
|
|
||||||
sha256 = "sha256-Mu0pmx3OWiKBmMEYLNg+u2MxFERK07BQGe3WAhEec5Q=";
|
|
||||||
};
|
|
||||||
|
|
||||||
compact = pkgs.fetchurl {
|
|
||||||
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg";
|
|
||||||
sha256 = "sha256-Mkf+GK4iuUhZdUdzMW0VUOmXcXcISejhMeZVm0uaRwY=";
|
|
||||||
};
|
|
||||||
|
|
||||||
mono = pkgs.fetchurl {
|
|
||||||
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg";
|
|
||||||
sha256 = "sha256-tZHV6g427zqYzrNf3wCwiCh5Vjo8PAai9uEvayYPsjM=";
|
|
||||||
};
|
|
||||||
|
|
||||||
ny = pkgs.fetchurl {
|
|
||||||
url = "https://devimages-cdn.apple.com/design/resources/download/NY.dmg";
|
|
||||||
sha256 = "sha256-tn1QLCSjgo5q4PwE/we80pJavr3nHVgFWrZ8cp29qBk=";
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [ p7zip ];
|
|
||||||
|
|
||||||
sourceRoot = ".";
|
|
||||||
|
|
||||||
dontUnpack = true;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
7z x ${pro}
|
|
||||||
cd SFProFonts
|
|
||||||
7z x 'SF Pro Fonts.pkg'
|
|
||||||
7z x 'Payload~'
|
|
||||||
mkdir -p $out/fontfiles
|
|
||||||
mv Library/Fonts/* $out/fontfiles
|
|
||||||
cd ..
|
|
||||||
7z x ${mono}
|
|
||||||
cd SFMonoFonts
|
|
||||||
7z x 'SF Mono Fonts.pkg'
|
|
||||||
7z x 'Payload~'
|
|
||||||
mv Library/Fonts/* $out/fontfiles
|
|
||||||
cd ..
|
|
||||||
7z x ${compact}
|
|
||||||
cd SFCompactFonts
|
|
||||||
7z x 'SF Compact Fonts.pkg'
|
|
||||||
7z x 'Payload~'
|
|
||||||
mv Library/Fonts/* $out/fontfiles
|
|
||||||
cd ..
|
|
||||||
7z x ${ny}
|
|
||||||
cd NYFonts
|
|
||||||
7z x 'NY Fonts.pkg'
|
|
||||||
7z x 'Payload~'
|
|
||||||
mv Library/Fonts/* $out/fontfiles
|
|
||||||
mkdir -p $out/usr/share/fonts/OTF $out/usr/share/fonts/TTF
|
|
||||||
mv $out/fontfiles/*.otf $out/usr/share/fonts/OTF
|
|
||||||
mv $out/fontfiles/*.ttf $out/usr/share/fonts/TTF
|
|
||||||
rm -rf $out/fontfiles
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "Apple San Francisco, New York fonts.";
|
|
||||||
homepage = "https://developer.apple.com/fonts/";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -86,7 +86,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, dotfiles, ... } @inputs: rec {
|
outputs = { self, nixpkgs, dotfiles, ... } @inputs: {
|
||||||
# Constant values.
|
# Constant values.
|
||||||
nixosModules.const = {
|
nixosModules.const = {
|
||||||
hashedPassword = "$y$j9T$oqCB16i5E2t1t/HAWaFd5.$tTaHtAcifXaDVpTcRv.yH2/eWKxKE9xM8KcqXHfHrD7"; # Use `mkpasswd`.
|
hashedPassword = "$y$j9T$oqCB16i5E2t1t/HAWaFd5.$tTaHtAcifXaDVpTcRv.yH2/eWKxKE9xM8KcqXHfHrD7"; # Use `mkpasswd`.
|
||||||
|
@ -131,13 +131,9 @@
|
||||||
inputs.self.nixosModules.common
|
inputs.self.nixosModules.common
|
||||||
] ++ modules;
|
] ++ modules;
|
||||||
|
|
||||||
specialArgs.const = self.nixosModules.const;
|
specialArgs.const = self.nixosModules.const;
|
||||||
specialArgs.flake = self;
|
specialArgs.flake = self;
|
||||||
specialArgs.inputs = inputs;
|
specialArgs.inputs = inputs;
|
||||||
specialArgs.applefont = ((import ./derivation/applefont/flake.nix).outputs {
|
|
||||||
inherit nixpkgs;
|
|
||||||
inherit system;
|
|
||||||
}).packages.${system}.default;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# List of all hosts bellow.
|
# List of all hosts bellow.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ pkgs, specialArgs, ... }: rec {
|
{ pkgs, ... }: {
|
||||||
fonts.packages = with pkgs; [
|
fonts.packages = with pkgs; [
|
||||||
specialArgs.applefont
|
(pkgs.callPackage ./applefont {})
|
||||||
(nerdfonts.override { fonts = [ "Terminus" ]; })
|
(nerdfonts.override { fonts = [ "Terminus" ]; })
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
54
.config/linux/system/module/common/applefont/default.nix
Normal file
54
.config/linux/system/module/common/applefont/default.nix
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
{ lib, stdenv, fetchurl, p7zip }: let
|
||||||
|
pro = fetchurl {
|
||||||
|
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg";
|
||||||
|
sha256 = "sha256-Mu0pmx3OWiKBmMEYLNg+u2MxFERK07BQGe3WAhEec5Q=";
|
||||||
|
};
|
||||||
|
|
||||||
|
compact = fetchurl {
|
||||||
|
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Compact.dmg";
|
||||||
|
sha256 = "sha256-Mkf+GK4iuUhZdUdzMW0VUOmXcXcISejhMeZVm0uaRwY=";
|
||||||
|
};
|
||||||
|
|
||||||
|
mono = fetchurl {
|
||||||
|
url = "https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg";
|
||||||
|
sha256 = "sha256-tZHV6g427zqYzrNf3wCwiCh5Vjo8PAai9uEvayYPsjM=";
|
||||||
|
};
|
||||||
|
|
||||||
|
ny = fetchurl {
|
||||||
|
url = "https://devimages-cdn.apple.com/design/resources/download/NY.dmg";
|
||||||
|
sha256 = "sha256-tn1QLCSjgo5q4PwE/we80pJavr3nHVgFWrZ8cp29qBk=";
|
||||||
|
};
|
||||||
|
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.unfree;
|
||||||
|
meta.platforms = platforms.all;
|
||||||
|
};
|
||||||
|
}
|
Reference in a new issue