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.
This commit is contained in:
		
							parent
							
								
									c4153008f7
								
							
						
					
					
						commit
						743497b565
					
				
					 2 changed files with 49 additions and 2 deletions
				
			
		| 
						 | 
					@ -4,7 +4,7 @@
 | 
				
			||||||
;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
 | 
					;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
 | 
				
			||||||
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 | 
					;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 | 
				
			||||||
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 | 
					;;; 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 © 2016 Chris Marusich <cmmarusich@gmail.com>
 | 
				
			||||||
;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
 | 
					;;; Copyright © 2017 Huang Ying <huang.ying.caritas@gmail.com>
 | 
				
			||||||
;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 | 
					;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 | 
				
			||||||
| 
						 | 
					@ -1338,6 +1338,50 @@ the entries in MANIFEST."
 | 
				
			||||||
                    `((type . profile-hook)
 | 
					                    `((type . profile-hook)
 | 
				
			||||||
                      (hook . manual-database))))
 | 
					                      (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
 | 
					(define %default-profile-hooks
 | 
				
			||||||
  ;; This is the list of derivation-returning procedures that are called by
 | 
					  ;; This is the list of derivation-returning procedures that are called by
 | 
				
			||||||
  ;; default when making a non-empty profile.
 | 
					  ;; default when making a non-empty profile.
 | 
				
			||||||
| 
						 | 
					@ -1349,6 +1393,7 @@ the entries in MANIFEST."
 | 
				
			||||||
        glib-schemas
 | 
					        glib-schemas
 | 
				
			||||||
        gtk-icon-themes
 | 
					        gtk-icon-themes
 | 
				
			||||||
        gtk-im-modules
 | 
					        gtk-im-modules
 | 
				
			||||||
 | 
					        texlive-configuration
 | 
				
			||||||
        xdg-desktop-database
 | 
					        xdg-desktop-database
 | 
				
			||||||
        xdg-mime-database))
 | 
					        xdg-mime-database))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
;;; GNU Guix --- Functional package management for GNU
 | 
					;;; GNU Guix --- Functional package management for GNU
 | 
				
			||||||
;;; Copyright © 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 | 
					;;; Copyright © 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 | 
				
			||||||
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 | 
					;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; This file is part of GNU Guix.
 | 
					;;; This file is part of GNU Guix.
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
| 
						 | 
					@ -318,6 +318,8 @@ on."
 | 
				
			||||||
     (G_ "building XDG MIME database..."))
 | 
					     (G_ "building XDG MIME database..."))
 | 
				
			||||||
    ('fonts-dir
 | 
					    ('fonts-dir
 | 
				
			||||||
     (G_ "building fonts directory..."))
 | 
					     (G_ "building fonts directory..."))
 | 
				
			||||||
 | 
					    ('texlive-configuration
 | 
				
			||||||
 | 
					     (G_ "building TeX Live configuration..."))
 | 
				
			||||||
    ('manual-database
 | 
					    ('manual-database
 | 
				
			||||||
     (G_ "building database for manual pages..."))
 | 
					     (G_ "building database for manual pages..."))
 | 
				
			||||||
    (_ #f)))
 | 
					    (_ #f)))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue