diff --git a/default.nix b/default.nix index 24b32e0..25a1da7 100644 --- a/default.nix +++ b/default.nix @@ -29,4 +29,5 @@ fairfax = pkgs.callPackage ./fonts/kreative/fairfax.nix {}; fairfax-hd = pkgs.callPackage ./fonts/kreative/fairfax-hd.nix {}; kreative-square = pkgs.callPackage ./fonts/kreative/kreative-square.nix {}; + nasin-nanpa = pkgs.callPackage ./fonts/nasin-nanpa {}; } diff --git a/fonts/kreative/kreative-square.nix b/fonts/kreative/kreative-square.nix index 6724de3..c14b8b1 100644 --- a/fonts/kreative/kreative-square.nix +++ b/fonts/kreative/kreative-square.nix @@ -1,6 +1,11 @@ -{ stdenv, callPackage, lib }: - let source = builtins.fromJSON (builtins.readFile ./source.json); - in stdenv.mkDerivation { +{ + stdenv, + callPackage, + lib, +}: let + source = builtins.fromJSON (builtins.readFile ./source.json); +in + stdenv.mkDerivation { name = "kreative-square"; version = source.date; src = callPackage ./source.nix {}; @@ -15,4 +20,4 @@ description = "Fullwidth scalable monospace font with many Box Drawing characters"; license = lib.licenses.ofl; }; - } \ No newline at end of file + } diff --git a/fonts/nasin-nanpa.nix b/fonts/nasin-nanpa.nix deleted file mode 100644 index 91176ca..0000000 --- a/fonts/nasin-nanpa.nix +++ /dev/null @@ -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 - ''; - }; -} diff --git a/fonts/nasin-nanpa/default.nix b/fonts/nasin-nanpa/default.nix new file mode 100644 index 0000000..d667b76 --- /dev/null +++ b/fonts/nasin-nanpa/default.nix @@ -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 + ''; + } diff --git a/fonts/nasin-nanpa/source.json b/fonts/nasin-nanpa/source.json new file mode 100644 index 0000000..07cccf7 --- /dev/null +++ b/fonts/nasin-nanpa/source.json @@ -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 +} diff --git a/fonts/nasin-nanpa/version.json b/fonts/nasin-nanpa/version.json new file mode 100644 index 0000000..e69de29