commit ecdb1288eb1ab635bfd8c81cedc5743fd99bbe8c Author: Artemis Tosini Date: Sun Sep 10 02:59:56 2023 +0000 Initial commit, with OCR-B diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a98ae65 --- /dev/null +++ b/LICENSE @@ -0,0 +1,3 @@ +My code: be gay do crime + +Fonts: Licenses described in flake.nix diff --git a/OCR-B-Regular.otf b/OCR-B-Regular.otf new file mode 100644 index 0000000..5fba217 Binary files /dev/null and b/OCR-B-Regular.otf differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..37272fc --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Archive of various fonts I've found and don't want to lose. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4102e73 --- /dev/null +++ b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1694310981, + "narHash": "sha256-Rf6ICXzUXfi2ILwEggBJMmVVR06AKS5DMcXZd1qi24o=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "49772c4112bf70d28086b459d31710408745f842", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..60097fe --- /dev/null +++ b/flake.nix @@ -0,0 +1,70 @@ +{ + description = "Various fonts I've found online"; + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:nixos/nixpkgs"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + }: + with builtins; + with nixpkgs.lib; + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs {inherit system;}; + buildFont = { + name, + files, + license, + author, + }: let + pathEndsWith = suffix: path: let + str = toString path; + sufLen = stringLength suffix; + sLen = stringLength str; + in + sufLen <= sLen && suffix == substring (sLen - sufLen) sufLen str; + + installType = 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}") filteredFiles); + in + pkgs.stdenvNoCC.mkDerivation { + inherit name; + + dontUnpack = true; + installPhase = '' + ${installType "ttf" "truetype"} + ${installType "otf" "opentype"} + ''; + + meta = { + inherit license; + platforms = platforms.all; + description = "${name} font by ${author}"; + }; + }; + + fonts = [ + { + name = "OCR-B"; + files = [./OCR-B-Regular.otf]; + license = licenses.cc-by-40; + author = "Matthew Anderson"; + } + ]; + in { + packages = listToAttrs (map (font: { + name = toLower font.name; + value = buildFont font; + }) + fonts); + + formatter = pkgs.alejandra; + }); +}