Compare commits
2 commits
90dfd51d7c
...
587fad82e8
Author | SHA1 | Date | |
---|---|---|---|
Artemis Tosini | 587fad82e8 | ||
Artemis Tosini | d42faf4840 |
|
@ -1,4 +1,11 @@
|
||||||
{ lib, fetchurl, stdenvNoCC, unzip, ipsw, _7zz }:
|
{
|
||||||
|
lib,
|
||||||
|
fetchurl,
|
||||||
|
stdenvNoCC,
|
||||||
|
unzip,
|
||||||
|
ipsw,
|
||||||
|
_7zz,
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
root = lib.importJSON ./assets.json;
|
root = lib.importJSON ./assets.json;
|
||||||
|
|
||||||
|
@ -32,30 +39,34 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
extra = lib.mapAttrs' mkExtraFont root.extra;
|
extra = lib.mapAttrs' mkExtraFont root.extra;
|
||||||
allExtra = (mkExtraFont "All Extra" root.all_extra).value;
|
allExtra = (mkExtraFont "All Extra" root.all_extra).value;
|
||||||
|
|
||||||
base = let data = root.base;
|
base =
|
||||||
in stdenvNoCC.mkDerivation {
|
let
|
||||||
pname = "macos-fonts-base";
|
data = root.base;
|
||||||
version = with data; "${version}-${build}";
|
in
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
|
pname = "macos-fonts-base";
|
||||||
|
version = with data; "${version}-${build}";
|
||||||
|
|
||||||
src = fetchurl { inherit (data) url hash; };
|
src = fetchurl { inherit (data) url hash; };
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
${ipsw}/bin/ipsw extract $src --dmg fs
|
${ipsw}/bin/ipsw extract $src --dmg fs
|
||||||
${_7zz}/bin/7zz e -i'!4.apfs' ${data.build}*/*.dmg
|
${_7zz}/bin/7zz e -i'!4.apfs' ${data.build}*/*.dmg
|
||||||
|
|
||||||
mkdir -p $out/share/fonts/apple
|
mkdir -p $out/share/fonts/apple
|
||||||
|
|
||||||
# This gives us some erros, ignore that
|
# This gives us some erros, ignore that
|
||||||
# Skipping overwrite because Apple has duplicate fonts for some reason
|
# Skipping overwrite because Apple has duplicate fonts for some reason
|
||||||
${_7zz}/bin/7zz e -i'!System/Library/Fonts' \
|
${_7zz}/bin/7zz e -i'!System/Library/Fonts' \
|
||||||
-i'!System/Library/PrivateFrameworks/FontServices.framework/Versions/A/Resources/Fonts/ApplicationSupport' \
|
-i'!System/Library/PrivateFrameworks/FontServices.framework/Versions/A/Resources/Fonts/ApplicationSupport' \
|
||||||
4.apfs -aos -o$out/share/fonts/apple || true
|
4.apfs -aos -o$out/share/fonts/apple || true
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
41
flake.lock
41
flake.lock
|
@ -5,9 +5,7 @@
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"utils": [
|
"utils": "utils"
|
||||||
"flake-utils"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720584070,
|
"lastModified": 1720584070,
|
||||||
|
@ -23,24 +21,6 @@
|
||||||
"url": "https://git.mildlyfunctional.gay/artemist/packages.git"
|
"url": "https://git.mildlyfunctional.gay/artemist/packages.git"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1710146030,
|
|
||||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721066811,
|
"lastModified": 1721066811,
|
||||||
|
@ -59,7 +39,6 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"artemist": "artemist",
|
"artemist": "artemist",
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -77,6 +56,24 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
349
flake.nix
349
flake.nix
|
@ -1,201 +1,180 @@
|
||||||
{
|
{
|
||||||
description = "Various fonts I've found online";
|
description = "Various fonts I've found online";
|
||||||
inputs = {
|
inputs = {
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs";
|
nixpkgs.url = "github:nixos/nixpkgs";
|
||||||
artemist = {
|
artemist = {
|
||||||
url = "git+https://git.mildlyfunctional.gay/artemist/packages.git";
|
url = "git+https://git.mildlyfunctional.gay/artemist/packages.git";
|
||||||
inputs.utils.follows = "flake-utils";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, artemist }:
|
outputs =
|
||||||
with nixpkgs.lib;
|
|
||||||
{
|
{
|
||||||
overlays.default = (final: prev:
|
self,
|
||||||
let
|
nixpkgs,
|
||||||
localFonts = [
|
artemist,
|
||||||
{
|
}:
|
||||||
# Popular font, used on NYC Subway
|
with nixpkgs.lib;
|
||||||
name = "Akzidenz-Grotesk Pro";
|
let
|
||||||
dir = ./Akzidenz-Grotesk-Pro;
|
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
||||||
license = licenses.unfree;
|
makePkgs =
|
||||||
author = "Berthold Type Foundry";
|
system:
|
||||||
}
|
import nixpkgs {
|
||||||
{
|
inherit system;
|
||||||
# Font used on DSB departure boards
|
overlays = [
|
||||||
name = "AtB";
|
self.overlays.default
|
||||||
dir = ./AtB;
|
artemist.overlays.default
|
||||||
license = licenses.unfree;
|
|
||||||
author = "Kontrapunkt";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Brussels-specific font
|
|
||||||
name = "Brusseline";
|
|
||||||
dir = ./Brusseline;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "Eric de Berranger";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Free handwriting font
|
|
||||||
name = "Caveat";
|
|
||||||
files = [ ./Caveat.ttf ];
|
|
||||||
license = licenses.ofl;
|
|
||||||
author = "Pablo Impallari and Alexi Vanyashin";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Twitter custom font, based on GT America
|
|
||||||
name = "Chirp";
|
|
||||||
dir = ./Chirp;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "Grilli Type Foundry";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Deutsche Bahn website font
|
|
||||||
name = "DB Screen";
|
|
||||||
dir = ./DB-Screen;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "URW Type Foundry";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Font with a large number of invented scripts
|
|
||||||
name = "Fairfax HD";
|
|
||||||
dir = ./Fairfax-HD;
|
|
||||||
license = licenses.ofl;
|
|
||||||
author = "Kreative Software";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Popular font, used on Amtrak
|
|
||||||
name = "Frutiger";
|
|
||||||
dir = ./Frutiger;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "Adrian Frutiger";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Discord custom font
|
|
||||||
name = "gg sans";
|
|
||||||
dir = ./ggsans;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "Colophon Foundry";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Several related fonts used for London Underground:
|
|
||||||
# * Johnston 100: Extension of original Johnston
|
|
||||||
# * New Johnston: Modification of original Johnston
|
|
||||||
# * P22 Underground: Version sold to public
|
|
||||||
name = "Johnston";
|
|
||||||
dir = ./Johnston;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "Edward Johnston et al";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Mysterious all-uppercase hand-style font for MIVB/STIB
|
|
||||||
name = "MIVB STIB";
|
|
||||||
dir = ./MIVB;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "unknown";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Also called "NR Brunel, used on UK railways in 2010s
|
|
||||||
name = "New Brunel";
|
|
||||||
dir = ./New-Brunel;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "David Quay";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Modern expansion of machine-readable font
|
|
||||||
name = "OCR-B";
|
|
||||||
files = [ ./OCR-B-Regular.otf ];
|
|
||||||
license = licenses.cc-by-40;
|
|
||||||
author = "Matthew Anderson";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Custom font used for RATP services in Parism
|
|
||||||
name = "Parisine";
|
|
||||||
dir = ./Parisine;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "Jean-François Porchez";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Font used on DSB website, similar to signage
|
|
||||||
name = "Via";
|
|
||||||
dir = ./Via;
|
|
||||||
license = licenses.unfree;
|
|
||||||
author = "Kontrapunkt";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
buildLocalFont = { name, files ? [ ], dir ? null, license, author }:
|
config.allowUnfree = true;
|
||||||
let
|
};
|
||||||
types = {
|
localFonts = [
|
||||||
ttf = "truetype";
|
{
|
||||||
otf = "opentype";
|
# Popular font, used on NYC Subway
|
||||||
};
|
name = "Akzidenz-Grotesk Pro";
|
||||||
|
dir = ./Akzidenz-Grotesk-Pro;
|
||||||
pathEndsWith = suffix: path:
|
license = licenses.unfree;
|
||||||
let
|
author = "Berthold Type Foundry";
|
||||||
str = toString path;
|
}
|
||||||
sufLen = stringLength suffix;
|
{
|
||||||
sLen = stringLength str;
|
# Font used on DSB departure boards
|
||||||
in sufLen <= sLen && suffix
|
name = "AtB";
|
||||||
== substring (sLen - sufLen) sufLen str;
|
dir = ./AtB;
|
||||||
|
license = licenses.unfree;
|
||||||
copyType = extension: pathName:
|
author = "Kontrapunkt";
|
||||||
let
|
}
|
||||||
filteredFiles = filter (pathEndsWith ("." + extension)) files;
|
{
|
||||||
filename = file:
|
# Brussels-specific font
|
||||||
lists.last (strings.splitString "/" (toString file));
|
name = "Brusseline";
|
||||||
in (optionalString (filteredFiles != [ ]) ''
|
dir = ./Brusseline;
|
||||||
mkdir -p $out/share/fonts/${pathName}
|
license = licenses.unfree;
|
||||||
'') + concatStringsSep "\n" (map (file:
|
author = "Eric de Berranger";
|
||||||
"cp -v ${file} $out/share/fonts/${pathName}/${filename file}")
|
}
|
||||||
filteredFiles);
|
{
|
||||||
|
# Free handwriting font
|
||||||
copyTypeDir = extension: pathName: ''
|
name = "Caveat";
|
||||||
if [ -n "$(shopt -s nullglob; echo ${dir}/*.${extension})" ]; then
|
files = [ ./Caveat.ttf ];
|
||||||
mkdir -p $out/share/fonts/${pathName}
|
license = licenses.ofl;
|
||||||
cp -v -t $out/share/fonts/${pathName} ${dir}/*.${extension}
|
author = "Pablo Impallari and Alexi Vanyashin";
|
||||||
fi
|
}
|
||||||
'';
|
{
|
||||||
|
# Twitter custom font, based on GT America
|
||||||
in final.stdenvNoCC.mkDerivation {
|
name = "Chirp";
|
||||||
inherit name;
|
dir = ./Chirp;
|
||||||
dontUnpack = true;
|
license = licenses.unfree;
|
||||||
installPhase = mapAttrsToList copyType types
|
author = "Grilli Type Foundry";
|
||||||
++ optional (dir != null) (mapAttrsToList copyTypeDir types);
|
}
|
||||||
|
{
|
||||||
passthru.font = true;
|
# Deutsche Bahn website font
|
||||||
meta = {
|
name = "DB Screen";
|
||||||
inherit license;
|
dir = ./DB-Screen;
|
||||||
platforms = platforms.all;
|
license = licenses.unfree;
|
||||||
maintainers = [ maintainers.artemist ];
|
author = "URW Type Foundry";
|
||||||
description = "${name} font by ${author}";
|
}
|
||||||
};
|
{
|
||||||
};
|
# Font with a large number of invented scripts
|
||||||
in {
|
name = "Fairfax HD";
|
||||||
extraFonts = listToAttrs (map (font: {
|
dir = ./Fairfax-HD;
|
||||||
name = replaceStrings [ " " ] [ "-" ] (toLower font.name);
|
license = licenses.ofl;
|
||||||
value = buildLocalFont font;
|
author = "Kreative Software";
|
||||||
}) localFonts);
|
}
|
||||||
|
{
|
||||||
|
# Popular font, used on Amtrak
|
||||||
|
name = "Frutiger";
|
||||||
|
dir = ./Frutiger;
|
||||||
|
license = licenses.unfree;
|
||||||
|
author = "Adrian Frutiger";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Discord custom font
|
||||||
|
name = "gg sans";
|
||||||
|
dir = ./ggsans;
|
||||||
|
license = licenses.unfree;
|
||||||
|
author = "Colophon Foundry";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Several related fonts used for London Underground:
|
||||||
|
# * Johnston 100: Extension of original Johnston
|
||||||
|
# * New Johnston: Modification of original Johnston
|
||||||
|
# * P22 Underground: Version sold to public
|
||||||
|
name = "Johnston";
|
||||||
|
dir = ./Johnston;
|
||||||
|
license = licenses.unfree;
|
||||||
|
author = "Edward Johnston et al";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Mysterious all-uppercase hand-style font for MIVB/STIB
|
||||||
|
name = "MIVB STIB";
|
||||||
|
dir = ./MIVB;
|
||||||
|
license = licenses.unfree;
|
||||||
|
author = "unknown";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Also called "NR Brunel, used on UK railways in 2010s
|
||||||
|
name = "New Brunel";
|
||||||
|
dir = ./New-Brunel;
|
||||||
|
license = licenses.unfree;
|
||||||
|
author = "David Quay";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Modern expansion of machine-readable font
|
||||||
|
name = "OCR-B";
|
||||||
|
files = [ ./OCR-B-Regular.otf ];
|
||||||
|
license = licenses.cc-by-40;
|
||||||
|
author = "Matthew Anderson";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Custom font used for RATP services in Parism
|
||||||
|
name = "Parisine";
|
||||||
|
dir = ./Parisine;
|
||||||
|
license = licenses.unfree;
|
||||||
|
author = "Jean-François Porchez";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Font used on DSB website, similar to signage
|
||||||
|
name = "Via";
|
||||||
|
dir = ./Via;
|
||||||
|
license = licenses.unfree;
|
||||||
|
author = "Kontrapunkt";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
overlays.default = (
|
||||||
|
final: prev:
|
||||||
|
let
|
||||||
|
buildLocalFont = final.callPackage ./nix/buildLocalFont.nix { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
extraFonts = listToAttrs (
|
||||||
|
map (font: {
|
||||||
|
name = replaceStrings [ " " ] [ "-" ] (toLower font.name);
|
||||||
|
value = buildLocalFont font;
|
||||||
|
}) localFonts
|
||||||
|
);
|
||||||
appleFonts = final.callPackage ./apple {
|
appleFonts = final.callPackage ./apple {
|
||||||
ipsw = if final ? ipsw then final.ipsw else artemist.packages.${final.stdenv.system}.ipsw;
|
ipsw = if final ? ipsw then final.ipsw else artemist.packages.${final.stdenv.system}.ipsw;
|
||||||
};
|
};
|
||||||
});
|
}
|
||||||
} // flake-utils.lib.eachDefaultSystem (system:
|
);
|
||||||
let
|
|
||||||
pkgs = import nixpkgs {
|
packages = forAllSystems (
|
||||||
inherit system;
|
system:
|
||||||
overlays = [ self.overlays.default artemist.overlays.default ];
|
builtins.listToAttrs (
|
||||||
config.allowUnfree = true;
|
map
|
||||||
};
|
(name: {
|
||||||
in {
|
inherit name;
|
||||||
packages = builtins.listToAttrs (map (name: {
|
value = (makePkgs system).${name} // {
|
||||||
inherit name;
|
type = "derivation";
|
||||||
value = pkgs.${name} // {
|
name = "dummy-attrset";
|
||||||
type = "derivation";
|
};
|
||||||
name = "dummy-attrset";
|
})
|
||||||
};
|
[
|
||||||
}) [ "extraFonts" "appleFonts" ]);
|
"extraFonts"
|
||||||
formatter = pkgs.nixfmt;
|
"appleFonts"
|
||||||
});
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
formatter = forAllSystems (system: (makePkgs system).nixfmt-rfc-style);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
58
nix/buildLocalFont.nix
Normal file
58
nix/buildLocalFont.nix
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{ lib, stdenvNoCC }:
|
||||||
|
{
|
||||||
|
name,
|
||||||
|
files ? [ ],
|
||||||
|
dir ? null,
|
||||||
|
license,
|
||||||
|
author,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
types = {
|
||||||
|
ttf = "truetype";
|
||||||
|
otf = "opentype";
|
||||||
|
};
|
||||||
|
|
||||||
|
pathEndsWith =
|
||||||
|
suffix: path:
|
||||||
|
let
|
||||||
|
str = toString path;
|
||||||
|
sufLen = lib.stringLength suffix;
|
||||||
|
sLen = lib.stringLength str;
|
||||||
|
in
|
||||||
|
sufLen <= sLen && suffix == lib.substring (sLen - sufLen) sufLen str;
|
||||||
|
|
||||||
|
copyType =
|
||||||
|
extension: pathName:
|
||||||
|
let
|
||||||
|
filteredFiles = lib.filter (pathEndsWith ("." + extension)) files;
|
||||||
|
filename = file: lib.lists.last (lib.strings.splitString "/" (toString file));
|
||||||
|
in
|
||||||
|
(lib.optionalString (filteredFiles != [ ]) ''
|
||||||
|
mkdir -p $out/share/fonts/${pathName}
|
||||||
|
'')
|
||||||
|
+ lib.concatStringsSep "\n" (
|
||||||
|
map (file: "cp -v ${file} $out/share/fonts/${pathName}/${filename file}") filteredFiles
|
||||||
|
);
|
||||||
|
|
||||||
|
copyTypeDir = extension: pathName: ''
|
||||||
|
if [ -n "$(shopt -s nullglob; echo ${dir}/*.${extension})" ]; then
|
||||||
|
mkdir -p $out/share/fonts/${pathName}
|
||||||
|
cp -v -t $out/share/fonts/${pathName} ${dir}/*.${extension}
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
|
inherit name;
|
||||||
|
dontUnpack = true;
|
||||||
|
installPhase =
|
||||||
|
lib.mapAttrsToList copyType types
|
||||||
|
++ lib.optional (dir != null) (lib.mapAttrsToList copyTypeDir types);
|
||||||
|
|
||||||
|
passthru.font = true;
|
||||||
|
meta = with lib; {
|
||||||
|
inherit license;
|
||||||
|
platforms = platforms.all;
|
||||||
|
maintainers = [ maintainers.artemist ];
|
||||||
|
description = "${name} font by ${author}";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue