guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

12/12: guix: Add profile hook to build TeX live configuration.


From: guix-commits
Subject: 12/12: guix: Add profile hook to build TeX live configuration.
Date: Tue, 15 Jan 2019 07:05:41 -0500 (EST)

rekado pushed a commit to branch master
in repository guix.

commit 743497b5650713e082f4775a3b7dfd03babc8191
Author: Ricardo Wurmus <address@hidden>
Date:   Tue Jan 15 13:03:48 2019 +0100

    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.
---
 guix/profiles.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
 guix/status.scm   |  4 +++-
 2 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index 8142e5e..d22539b 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2014, 2016 Alex Kost <address@hidden>
 ;;; Copyright © 2015 Mark H Weaver <address@hidden>
 ;;; Copyright © 2015 Sou Bunnbu <address@hidden>
-;;; Copyright © 2016, 2018 Ricardo Wurmus <address@hidden>
+;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <address@hidden>
 ;;; Copyright © 2016 Chris Marusich <address@hidden>
 ;;; Copyright © 2017 Huang Ying <address@hidden>
 ;;; Copyright © 2017 Maxim Cournoyer <address@hidden>
@@ -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))
 
diff --git a/guix/status.scm b/guix/status.scm
index 478c475..67bb9e3 100644
--- a/guix/status.scm
+++ b/guix/status.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017, 2018, 2019 Ludovic Courtès <address@hidden>
-;;; Copyright © 2018 Ricardo Wurmus <address@hidden>
+;;; Copyright © 2018, 2019 Ricardo Wurmus <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -318,6 +318,8 @@ on."
      (G_ "building XDG MIME database..."))
     ('fonts-dir
      (G_ "building fonts directory..."))
+    ('texlive-configuration
+     (G_ "building TeX Live configuration..."))
     ('manual-database
      (G_ "building database for manual pages..."))
     (_ #f)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]