mirror of
https://github.com/daylinmorgan/monolisa-nerdfont-patch.git
synced 2024-12-22 06:50:44 -06:00
build package
This commit is contained in:
parent
569b5a3569
commit
680f3b6917
3 changed files with 38 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -185,3 +185,4 @@ patched/*
|
||||||
nerd-fonts
|
nerd-fonts
|
||||||
.env
|
.env
|
||||||
font-patcher-log.txt
|
font-patcher-log.txt
|
||||||
|
result
|
||||||
|
|
30
flake.nix
30
flake.nix
|
@ -12,6 +12,36 @@
|
||||||
["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]
|
["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]
|
||||||
(system: f nixpkgs.legacyPackages.${system});
|
(system: f nixpkgs.legacyPackages.${system});
|
||||||
in {
|
in {
|
||||||
|
packages = forAllSystems (
|
||||||
|
pkgs:
|
||||||
|
with pkgs; {
|
||||||
|
default = stdenv.mkDerivation {
|
||||||
|
name = "monolisa-nerdfont-patch";
|
||||||
|
src = ./.;
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
buildInputs = [
|
||||||
|
fontforge
|
||||||
|
python3
|
||||||
|
];
|
||||||
|
unpackPhase = ":";
|
||||||
|
buildPhase = ":";
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
install -m755 -D ${./patch-monolisa} $out/bin/monolisa-nerdfont-patch
|
||||||
|
install -m755 -D ${./font-patcher} $out/bin/font-patcher
|
||||||
|
cp -r ${./bin} $out/bin/bin
|
||||||
|
cp -r ${./src} $out/bin/src
|
||||||
|
'';
|
||||||
|
postFixup = ''
|
||||||
|
wrapProgram $out/bin/monolisa-nerdfont-patch \
|
||||||
|
--set PATH ${lib.makeBinPath [
|
||||||
|
fontforge
|
||||||
|
]}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
devShells = forAllSystems (
|
devShells = forAllSystems (
|
||||||
pkgs:
|
pkgs:
|
||||||
with pkgs; {
|
with pkgs; {
|
||||||
|
|
|
@ -10,8 +10,6 @@ import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Set
|
from typing import List, Set
|
||||||
|
|
||||||
FONT_SRC = (Path(__file__).parent / "MonoLisa").absolute()
|
|
||||||
|
|
||||||
|
|
||||||
class Color:
|
class Color:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -133,16 +131,16 @@ def patch_single_font(
|
||||||
font_path: Path, output_dir: Path, fp_args: str, verbose: bool
|
font_path: Path, output_dir: Path, fp_args: str, verbose: bool
|
||||||
) -> None:
|
) -> None:
|
||||||
# update display name to full resolved path
|
# update display name to full resolved path
|
||||||
rel_path = font_path.absolute().relative_to(FONT_SRC)
|
rel_path = font_path.absolute()
|
||||||
output_path = (output_dir / rel_path).parent
|
output_path = (output_dir / rel_path.parent.name).absolute()
|
||||||
output_path.mkdir(exist_ok=True, parents=True)
|
output_path.mkdir(exist_ok=True, parents=True)
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
"fontforge",
|
"fontforge",
|
||||||
"-script",
|
"-script",
|
||||||
"./font-patcher",
|
f"{Path(__file__).parent}/font-patcher",
|
||||||
"--glyphdir",
|
"--glyphdir",
|
||||||
"./src/glyphs/",
|
f"{Path(__file__).parent}/src/glyphs/",
|
||||||
"-out",
|
"-out",
|
||||||
f"{output_path}",
|
f"{output_path}",
|
||||||
f"{font_path.absolute()}",
|
f"{font_path.absolute()}",
|
||||||
|
@ -171,7 +169,9 @@ def collect_files_by_dir(fontfiles: List[Path]) -> Set[Path]:
|
||||||
def patch_font_dir_docker(
|
def patch_font_dir_docker(
|
||||||
font_dir_path: Path, output_dir: Path, fp_args: str, verbose: bool
|
font_dir_path: Path, output_dir: Path, fp_args: str, verbose: bool
|
||||||
) -> None:
|
) -> None:
|
||||||
output_path = (output_dir / font_dir_path.relative_to(FONT_SRC)).absolute()
|
output_path = (
|
||||||
|
output_dir / font_dir_path.relative_to(font_dir_path.parent)
|
||||||
|
).absolute()
|
||||||
output_path.mkdir(exist_ok=True, parents=True)
|
output_path.mkdir(exist_ok=True, parents=True)
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|
Loading…
Reference in a new issue