Initial commit, with OCR-B

This commit is contained in:
Artemis Tosini 2023-09-10 02:59:56 +00:00
commit ecdb1288eb
Signed by: artemist
GPG key ID: EE5227935FE3FF18
6 changed files with 135 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

3
LICENSE Normal file
View file

@ -0,0 +1,3 @@
My code: be gay do crime
Fonts: Licenses described in flake.nix

BIN
OCR-B-Regular.otf Normal file

Binary file not shown.

1
README.md Normal file
View file

@ -0,0 +1 @@
Archive of various fonts I've found and don't want to lose.

60
flake.lock Normal file
View file

@ -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
}

70
flake.nix Normal file
View file

@ -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;
});
}