]> git.ekhem.eu.org Git - guix.git/commitdiff
[common] Package the Meslo LG font.
authorJakub Czajka <jakub@ekhem.eu.org>
Sat, 24 Dec 2022 12:38:06 +0000 (13:38 +0100)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:53:07 +0000 (19:53 +0100)
conf/common/fonts.scm [new file with mode: 0644]

diff --git a/conf/common/fonts.scm b/conf/common/fonts.scm
new file mode 100644 (file)
index 0000000..2bf0ce8
--- /dev/null
@@ -0,0 +1,58 @@
+;; Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+;; License: GPL-3.0 or later.
+;;
+;; fonts.scm - packages for fonts.
+
+(define-module (conf common fonts)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu services)
+  #:use-module (guix build-system trivial)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module (guix licenses)
+  #:use-module (guix packages)
+  #:export (font-meslo))
+
+(define font-meslo
+  (package
+   (name "font-meslo")
+   (version "1.2.1")
+   (source
+    (origin
+     (method git-fetch)
+     (uri (git-reference
+          (url "https://github.com/andreberg/Meslo-Font")
+          (commit "c7ee3ce8fa43de2a9c99e94677ea9d1c46e56f26")))
+     (sha256
+      (base32
+       "1594lxdk6788bb3i3c2fh74z4pwpzcp2r1xl3cz8cz77nrcjkl8m"))))
+   (build-system trivial-build-system)
+   (arguments
+    `(#:modules ((guix build utils))
+      #:builder
+      (begin
+       (use-modules (guix build utils))
+       (let* ((unzip (string-append (assoc-ref %build-inputs "unzip")
+                                     "/bin/unzip"))
+              (ins     (assoc-ref %build-inputs "source"))
+              (out     (assoc-ref %outputs "out"))
+              (ver     (string-append "v" ,version))
+              (in-dir  (string-concatenate (list ins "/dist/" ver)))
+              (fonts   (string-append "Meslo LG " ver))
+              (archive (string-concatenate (list in-dir "/" fonts)))
+              (out-dir (string-append out "/share/fonts"))
+              (file    (string-append out-dir "/meslo-regular.ttf")))
+         (system* unzip archive)
+         (mkdir-p out-dir)
+         (for-each (lambda (font)
+                      (copy-file font
+                                 (string-append out-dir "/"
+                                                (basename font))))
+                     (find-files fonts "\\.ttf$"))))))
+   (native-inputs
+    `(("source" ,source)
+      ("unzip" ,unzip)))
+   (synopsis "Custom version of Apple’s Menlo-Regular font.")
+   (description "Meslo LG is a customized version of Apple’s Menlo-Regular font.")
+   (home-page "https://github.com/andreberg/Meslo-Font")
+   (license asl2.0)))