From 09763cfcb466a785e9203ef51f00038b3a125beb Mon Sep 17 00:00:00 2001 From: Denis Knauf Date: Fri, 17 Jan 2025 22:00:37 +0100 Subject: [PATCH] install -> Makefile. flake upgrade --- Makefile | 21 ++++++++++++++++++-- fetchfont.nix | 54 +-------------------------------------------------- flake.lock | 8 ++++---- flake.nix | 2 +- 4 files changed, 25 insertions(+), 60 deletions(-) diff --git a/Makefile b/Makefile index be40d7c..fd27f7e 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,28 @@ CACHES := $(patsubst %,%.fc,$(FONTS)) all: fonts caches .PHONY: all +install: + mkdir -p $(D)/share/{doc/$(name),fonts/{opentype,truetype,WOFF,WOFF2}{,/.fc}} + find . -name \*.otf -exec cp {} $(D)/share/fonts/opentype \; + find . -name \*.ttf -exec cp {} $(D)/share/fonts/truetype \; + find . -name \*.woff -exec cp {} $(D)/share/fonts/WOFF \; + find . -name \*.woff2 -exec cp {} $(D)/share/fonts/WOFF2 \; + find . -name \*.otf.fc -exec cp {} $(D)/share/fonts/opentype/.fc \; + find . -name \*.ttf.fc -exec cp {} $(D)/share/fonts/truetype/.fc \; + find . -name \*.woff.fc -exec cp {} $(D)/share/fonts/WOFF/.fc \; + find . -name \*.woff2.fc -exec cp {} $(D)/share/fonts/WOFF2/.fc \; + find "$(S)" -name \*.txt -exec cp {} $(D)/share/doc/$(name) \; + find "$(S)" -name \*.md -exec cp {} $(D)/share/doc/$(name) \; + find "$(S)" -name \*.adoc -exec cp {} $(D)/share/doc/$(name) \; + find "$(S)" -name \*.html -exec cp {} $(D)/share/doc/$(name) \; + find "$(S)" -name \*.css -exec cp {} $(D)/share/doc/$(name) \; +.PHONY: install + fonts: $(FONTS) -.PHONY: all +.PHONY: fonts caches: $(CACHES) -.PHONY: all +.PHONY: caches %.woff: %.otf sfnt2woff-zopfli "$<" diff --git a/fetchfont.nix b/fetchfont.nix index b1593c2..72f252c 100644 --- a/fetchfont.nix +++ b/fetchfont.nix @@ -41,60 +41,8 @@ done make -j all ''; -# for s in *.otf *.ttf -# do -# bn="''${s%.otf}" -# bn="''${bn%.ttf}" -# if ! [ -e "$bn.woff" ] -# then -# echo "sfnt2woff-zopfli $s => $bn.woff" -# sfnt2woff-zopfli "$s" -# fi -# if ! [ -e "$bn.woff2" ] -# then -# echo "woff2_compress $s => $bn.woff2" -# woff2_compress "$s" -# fi -# done -# -# for s in *.otf *.ttf *.woff -# do -# fc="`dirname "$s"`/`basename "$s"`.fc" -# echo "fc-scan $s" -# LANG=C LC_NUMERIC=C fc-scan --format 'family=%{family} -#fullname=%{fullname} -#postscriptname=%{postscriptname} -#variable=%{variable} -#slant=%{slant} -#style=%{style} -#weight=%{weight} -#width=%{width} -# -#' "$s" > "$fc" -# done -# for s in *.woff2 -# do -# o="`dirname "$s"`/`basename "$s" .woff2`.woff.fc" -# fc="`dirname "$s"`/`basename "$s"`.fc" -# cp "$o" "$fc" -# done -# ''; installPhase = '' - cd "$TMPDIR" - mkdir -p $out/share/{doc/${name_},fonts/{opentype,truetype,WOFF,WOFF2}{,/.fc}} - find "$build_dir" -name \*.otf -exec cp \{\} $out/share/fonts/opentype \; - find "$build_dir" -name \*.ttf -exec cp \{\} $out/share/fonts/truetype \; - find "$build_dir" -name \*.woff -exec cp \{\} $out/share/fonts/WOFF \; - find "$build_dir" -name \*.woff2 -exec cp \{\} $out/share/fonts/WOFF2 \; - find "$build_dir" -name \*.otf.fc -exec cp \{\} $out/share/fonts/opentype/.fc \; - find "$build_dir" -name \*.ttf.fc -exec cp \{\} $out/share/fonts/truetype/.fc \; - find "$build_dir" -name \*.woff.fc -exec cp \{\} $out/share/fonts/WOFF/.fc \; - find "$build_dir" -name \*.woff2.fc -exec cp \{\} $out/share/fonts/WOFF2/.fc \; - find "$source_dir" -name \*.txt -exec cp \{\} $out/share/doc/${name_} \; - find "$source_dir" -name \*.md -exec cp \{\} $out/share/doc/${name_} \; - find "$source_dir" -name \*.adoc -exec cp \{\} $out/share/doc/${name_} \; - find "$source_dir" -name \*.html -exec cp \{\} $out/share/doc/${name_} \; - find "$source_dir" -name \*.css -exec cp \{\} $out/share/doc/${name_} \; + make -j install D=$out name=${name_} S=$source_dir ''; } // ( if null != src diff --git a/flake.lock b/flake.lock index 01daa97..18eece8 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1724316499, - "narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=", + "lastModified": 1737041218, + "narHash": "sha256-LOFldh08l0DN1zZoDZRYODQ6874FH6RJ9Im8dO19Uhg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841", + "rev": "3355599fa13a9bfb29f9b875bd5991ff0bf9b2a1", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.05-small", + "ref": "nixos-24.11-small", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 73c1c7c..c782fd6 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ # vim: set et sw=2 ts=2 sts=2: { description = "fonts"; - inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-24.05-small; + inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-24.11-small; outputs = { self, nixpkgs }: let allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];