[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/11: profiles: Add fonts-dir-file hook.
From: |
Alex Kost |
Subject: |
04/11: profiles: Add fonts-dir-file hook. |
Date: |
Mon, 25 Jul 2016 14:22:21 +0000 (UTC) |
alezost pushed a commit to branch master
in repository guix.
commit 9eb5a449eed7297fdc2e6f3e77c2f625b07fddd1
Author: Alex Kost <address@hidden>
Date: Thu Jun 30 22:01:06 2016 +0300
profiles: Add fonts-dir-file hook.
* guix/profiles.scm (fonts-dir-file): New procedure.
(%default-profile-hooks): Add it.
---
guix/profiles.scm | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 77df6ad..1adb143 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
-;;; Copyright © 2014 Alex Kost <address@hidden>
+;;; Copyright © 2014, 2016 Alex Kost <address@hidden>
;;; Copyright © 2015 Mark H Weaver <address@hidden>
;;; Copyright © 2015 Sou Bunnbu <address@hidden>
;;;
@@ -756,10 +756,51 @@ entries. It's used to query the MIME type of a given
file."
#:substitutable? #f)
(return #f))))
+(define (fonts-dir-file manifest)
+ "Return a derivation that builds the @file{fonts.dir} and @file{fonts.scale}
+files for the truetype fonts of the @var{manifest} entries."
+ (define mkfontscale
+ (module-ref (resolve-interface '(gnu packages xorg)) 'mkfontscale))
+
+ (define mkfontdir
+ (module-ref (resolve-interface '(gnu packages xorg)) 'mkfontdir))
+
+ (define build
+ #~(begin
+ (use-modules (srfi srfi-26)
+ (guix build utils)
+ (guix build union))
+ (let ((ttf-dirs (filter file-exists?
+ (map (cut string-append <>
+ "/share/fonts/truetype")
+ '#$(manifest-inputs manifest)))))
+ (mkdir #$output)
+ (if (null? ttf-dirs)
+ (exit #t)
+ (let* ((fonts-dir (string-append #$output "/share/fonts"))
+ (ttf-dir (string-append fonts-dir "/truetype"))
+ (mkfontscale (string-append #+mkfontscale
+ "/bin/mkfontscale"))
+ (mkfontdir (string-append #+mkfontdir
+ "/bin/mkfontdir")))
+ (mkdir-p fonts-dir)
+ (union-build ttf-dir ttf-dirs
+ #:log-port (%make-void-port "w"))
+ (with-directory-excursion ttf-dir
+ (exit (and (zero? (system* mkfontscale))
+ (zero? (system* mkfontdir))))))))))
+
+ (gexp->derivation "fonts-dir" build
+ #:modules '((guix build utils)
+ (guix build union))
+ #:local-build? #t
+ #:substitutable? #f))
+
(define %default-profile-hooks
;; This is the list of derivation-returning procedures that are called by
;; default when making a non-empty profile.
(list info-dir-file
+ fonts-dir-file
ghc-package-cache-file
ca-certificate-bundle
gtk-icon-themes
- branch master updated (1925a87 -> 424a323), Alex Kost, 2016/07/25
- 05/11: doc: Describe how to make X server find TrueType fonts., Alex Kost, 2016/07/25
- 01/11: gnu: Add xfontsel., Alex Kost, 2016/07/25
- 09/11: gnu: emacs: Install site-start.el in non-versioned directory., Alex Kost, 2016/07/25
- 03/11: gnu: mkfontdir: Do not propagate 'mkfontscale'., Alex Kost, 2016/07/25
- 04/11: profiles: Add fonts-dir-file hook.,
Alex Kost <=
- 06/11: gnu: Add xdpyprobe., Alex Kost, 2016/07/25
- 02/11: gnu: Add xfd., Alex Kost, 2016/07/25
- 08/11: gnu: Add guile-daemon., Alex Kost, 2016/07/25
- 10/11: gnu: emacs-solarized-theme: Remove unneeded dependencies., Alex Kost, 2016/07/25
- 11/11: doc: Explain when guix edit is read-only., Alex Kost, 2016/07/25
- 07/11: gnu: Add guile-xosd., Alex Kost, 2016/07/25