Convert gg sans to ttf
This commit is contained in:
parent
a5002a6881
commit
5345a28290
12
flake.lock
12
flake.lock
|
@ -5,11 +5,11 @@
|
|||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1692799911,
|
||||
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
|
||||
"lastModified": 1701680307,
|
||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
|
||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -20,11 +20,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1694310981,
|
||||
"narHash": "sha256-Rf6ICXzUXfi2ILwEggBJMmVVR06AKS5DMcXZd1qi24o=",
|
||||
"lastModified": 1702840599,
|
||||
"narHash": "sha256-jjWgSOWriN0fJ/uh3kkKzQjb9O21GdTsfDo1JVg75Xg=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "49772c4112bf70d28086b459d31710408745f842",
|
||||
"rev": "b425dc72ad3eb4d71524c0af237fcc7a728247f6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
48
flake.nix
48
flake.nix
|
@ -5,48 +5,42 @@
|
|||
nixpkgs.url = "github:nixos/nixpkgs";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
outputs = { self, nixpkgs, flake-utils, }:
|
||||
with builtins;
|
||||
with nixpkgs.lib;
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
pathEndsWith = suffix: path: let
|
||||
pathEndsWith = suffix: path:
|
||||
let
|
||||
str = toString path;
|
||||
sufLen = stringLength suffix;
|
||||
sLen = stringLength str;
|
||||
in
|
||||
sufLen <= sLen && suffix == substring (sLen - sufLen) sufLen str;
|
||||
in sufLen <= sLen && suffix == substring (sLen - sufLen) sufLen str;
|
||||
|
||||
buildFont = {
|
||||
name,
|
||||
files,
|
||||
license,
|
||||
author,
|
||||
}: let
|
||||
copyType = extension: pathName: let
|
||||
buildFont = { name, files, license, author, }:
|
||||
let
|
||||
copyType = extension: pathName:
|
||||
let
|
||||
filteredFiles = filter (pathEndsWith ("." + extension)) files;
|
||||
filename = file: lists.last (strings.splitString "/" (toString file));
|
||||
in
|
||||
(optionalString (filteredFiles != []) "mkdir -p $out/share/fonts/${pathName}\n")
|
||||
+ concatStringsSep "\n" (map (file: "cp -v ${file} $out/share/fonts/${pathName}/${filename file}")
|
||||
filename = file:
|
||||
lists.last (strings.splitString "/" (toString file));
|
||||
in (optionalString (filteredFiles != [ ]) ''
|
||||
mkdir -p $out/share/fonts/${pathName}
|
||||
'') + concatStringsSep "\n" (map (file:
|
||||
"cp -v ${file} $out/share/fonts/${pathName}/${filename file}")
|
||||
filteredFiles);
|
||||
in
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
in pkgs.stdenvNoCC.mkDerivation {
|
||||
inherit name;
|
||||
|
||||
dontUnpack = true;
|
||||
installPhase = ''
|
||||
${copyType "ttf" "truetype"}
|
||||
${copyType "otf" "opentype"}
|
||||
${copyType "woff2" "woff2"}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
@ -65,7 +59,8 @@
|
|||
}
|
||||
{
|
||||
name = "gg sans";
|
||||
files = [./ggsans-Normal.woff2 ./ggsans-Medium.woff2 ./ggsans-SemiBold.woff2];
|
||||
files =
|
||||
[ ./ggsans-Normal.ttf ./ggsans-Medium.ttf ./ggsans-SemiBold.ttf ];
|
||||
license = licenses.unfree;
|
||||
author = "Colophon Foundry";
|
||||
}
|
||||
|
@ -80,9 +75,8 @@
|
|||
packages = listToAttrs (map (font: {
|
||||
name = replaceStrings [ " " ] [ "-" ] (toLower font.name);
|
||||
value = buildFont font;
|
||||
})
|
||||
fonts);
|
||||
}) fonts);
|
||||
|
||||
formatter = pkgs.alejandra;
|
||||
formatter = pkgs.nixfmt;
|
||||
});
|
||||
}
|
||||
|
|
BIN
ggsans-Medium.ttf
Normal file
BIN
ggsans-Medium.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
ggsans-Normal.ttf
Normal file
BIN
ggsans-Normal.ttf
Normal file
Binary file not shown.
Binary file not shown.
BIN
ggsans-SemiBold.ttf
Normal file
BIN
ggsans-SemiBold.ttf
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue