add nasin-nanpa

This commit is contained in:
Charlotte 🦝 Delenk 2022-09-25 18:45:55 +01:00
parent b88153f320
commit 3040d1bcfb
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
6 changed files with 52 additions and 36 deletions

View file

@ -29,4 +29,5 @@
fairfax = pkgs.callPackage ./fonts/kreative/fairfax.nix {}; fairfax = pkgs.callPackage ./fonts/kreative/fairfax.nix {};
fairfax-hd = pkgs.callPackage ./fonts/kreative/fairfax-hd.nix {}; fairfax-hd = pkgs.callPackage ./fonts/kreative/fairfax-hd.nix {};
kreative-square = pkgs.callPackage ./fonts/kreative/kreative-square.nix {}; kreative-square = pkgs.callPackage ./fonts/kreative/kreative-square.nix {};
nasin-nanpa = pkgs.callPackage ./fonts/nasin-nanpa {};
} }

View file

@ -1,6 +1,11 @@
{ stdenv, callPackage, lib }: {
let source = builtins.fromJSON (builtins.readFile ./source.json); stdenv,
in stdenv.mkDerivation { callPackage,
lib,
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
in
stdenv.mkDerivation {
name = "kreative-square"; name = "kreative-square";
version = source.date; version = source.date;
src = callPackage ./source.nix {}; src = callPackage ./source.nix {};
@ -15,4 +20,4 @@
description = "Fullwidth scalable monospace font with many Box Drawing characters"; description = "Fullwidth scalable monospace font with many Box Drawing characters";
license = lib.licenses.ofl; license = lib.licenses.ofl;
}; };
} }

View file

@ -1,32 +0,0 @@
{
inputs,
pkgs,
...
}: rec {
nasin-nanpa = pkgs.stdenvNoCC.mkDerivation rec {
pname = "nasin-nanpa";
version = "2.5.25";
src = inputs.nasin-nanpa;
nativeBuildInputs = [pkgs.fontforge];
buildPhase = ''
fontforge -lang=ff -c 'Open($1); Generate($2)' "ffversions/2.5/nasin-nanpa-${version}.sfd" "nasin-nanpa.otf"
'';
installPhase = ''
install -m444 -Dt $out/share/fonts/opentype/nasin-nanpa nasin-nanpa.otf
'';
};
nasin-nanpa-woff2 = pkgs.stdenvNoCC.mkDerivation rec {
name = "nasin-nanpa-${nasin-nanpa.version}.woff2";
inherit (nasin-nanpa) version;
src = inputs.nasin-nanpa;
buildInputs = [nasin-nanpa];
nativeBuildInputs = [pkgs.woff2];
buildPhase = ''
cp ${nasin-nanpa}/share/fonts/opentype/nasin-nanpa/nasin-nanpa.otf .
woff2_compress nasin-nanpa.otf
'';
installPhase = ''
cp nasin-nanpa.woff2 $out
'';
};
}

View file

@ -0,0 +1,31 @@
{
stdenv,
fontforge,
fetchFromGitHub,
lib,
writeScript,
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
version = builtins.fromJSON (builtins.readFile ./version.json);
in
stdenv.mkDerivation {
pname = "nasin-nanpa";
version = "${version.minor}";
src = fetchFromGitHub {
owner = "ETBCOR";
repo = "nasin-nanpa";
inherit (source) rev sha256;
};
nativeBuildInputs = [fontforge];
buildPhase = "fontforge -lang=ff -c 'Open($1); Generate($2)' \"ffversions/${version.major}/nasin-nanpa-${version.minor}.sfd\" \"nasin-nanpa.otf\"";
installPhase = "install -m444 -Dt $out/share/fonts/opentype/nasin-nanpa nasin-nanpa.otf";
meta = {
description = "A font for sitelen pona";
license = lib.licenses.mit;
};
passthru.updateScript = writeScript "update-nasin-nanpa" ''
${../../scripts/update-git.sh} https://github.com/ETBCOR/nasin-nanpa fonts/nasin-nanpa/source.json
SRC_PATH=$(nix-build -E '(import ./. {}).nasin-nanpa.src')
ls ffversions/*/*.sfd | sort | tail -n1 | sed 's|[/-]| |g' | sed 's/.sfd//' | awk '{print "{\"major\": \"" $2 "\", \"minor\": \"" $5 "\"}" }' > fonts/nasin-nanpa/version.json
'';
}

View file

@ -0,0 +1,11 @@
{
"url": "https://github.com/ETBCOR/nasin-nanpa",
"rev": "4cf4a762576d8ca2818683139ab1d04d149c9bec",
"date": "2022-05-22T16:25:11-07:00",
"path": "/nix/store/riz85kank0n3d94jnhyl8yn4cy100653-nasin-nanpa",
"sha256": "172asramnmp0m8h6sm8mvzap1ys2zngbrd4m5gq2w899vr8qzpbz",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}

View file