summaryrefslogtreecommitdiff
path: root/guix/profiles.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-01-15 13:03:48 +0100
committerRicardo Wurmus <rekado@elephly.net>2019-01-15 13:05:22 +0100
commit743497b5650713e082f4775a3b7dfd03babc8191 (patch)
treee3e16a02e9c31f63a2a679464668059b180d7a9c /guix/profiles.scm
parentc4153008f701d5cd335536adf711fa335f98141d (diff)
downloadpatches-743497b5650713e082f4775a3b7dfd03babc8191.tar
patches-743497b5650713e082f4775a3b7dfd03babc8191.tar.gz
guix: Add profile hook to build TeX live configuration.
* guix/profiles.scm (texlive-configuration): New procedure. (%default-profile-hooks): Add it. * guix/status.scm (hook-message): Handle "texlive-configuration" hook type.
Diffstat (limited to 'guix/profiles.scm')
-rw-r--r--guix/profiles.scm47
1 files changed, 46 insertions, 1 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 8142e5e8e2..d22539bdb2 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -4,7 +4,7 @@
;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
-;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
@@ -1338,6 +1338,50 @@ the entries in MANIFEST."
`((type . profile-hook)
(hook . manual-database))))
+(define (texlive-configuration manifest)
+ "Return a derivation that builds a TeXlive configuration for the entries in
+MANIFEST."
+ (define entry->texlive-input
+ (match-lambda
+ (($ <manifest-entry> name version output thing deps)
+ (if (string-prefix? "texlive-" name)
+ (cons (gexp-input thing output)
+ (append-map entry->texlive-input deps))
+ '()))))
+ (define build
+ (with-imported-modules '((guix build utils)
+ (guix build union))
+ #~(begin
+ (use-modules (guix build utils)
+ (guix build union))
+
+ ;; Build a modifiable union of all texlive inputs. We do this so
+ ;; that TeX live can resolve the parent and grandparent directories
+ ;; correctly. There might be a more elegant way to accomplish this.
+ (union-build #$output
+ '#$(append-map entry->texlive-input
+ (manifest-entries manifest))
+ #:create-all-directories? #t
+ #:log-port (%make-void-port "w"))
+ (substitute* (string-append #$output
+ "/share/texmf-dist/web2c/texmf.cnf")
+ (("^TEXMFROOT = .*")
+ (string-append "TEXMFROOT = " #$output "/share\n"))
+ (("^TEXMF = .*")
+ "TEXMF = $TEXMFROOT/share/texmf-dist\n"))
+ #t)))
+
+ (with-monad %store-monad
+ (if (any (cut string-prefix? "texlive-" <>)
+ (map manifest-entry-name (manifest-entries manifest)))
+ (gexp->derivation "texlive-configuration" build
+ #:substitutable? #f
+ #:local-build? #t
+ #:properties
+ `((type . profile-hook)
+ (hook . texlive-configuration)))
+ (return #f))))
+
(define %default-profile-hooks
;; This is the list of derivation-returning procedures that are called by
;; default when making a non-empty profile.
@@ -1349,6 +1393,7 @@ the entries in MANIFEST."
glib-schemas
gtk-icon-themes
gtk-im-modules
+ texlive-configuration
xdg-desktop-database
xdg-mime-database))