summaryrefslogtreecommitdiff
path: root/guix/profiles.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/profiles.scm')
-rw-r--r--guix/profiles.scm106
1 files changed, 48 insertions, 58 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 1d354ecb78..86926d6793 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014, 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
@@ -1738,8 +1738,8 @@ MANIFEST contains the \"man-db\" package. Otherwise, return #f."
(manual-database manifest)
(return #f))))
-(define (texlive-configuration manifest)
- "Return a derivation that builds a TeXlive configuration for the entries in
+(define (texlive-font-maps manifest)
+ "Return a derivation that builds the TeX Live font maps for the entries in
MANIFEST."
(define entry->texlive-input
(match-lambda
@@ -1768,72 +1768,56 @@ MANIFEST."
;; 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
+ (union-build "/tmp/texlive"
'#$(append-map entry->texlive-input
(manifest-entries manifest))
#:create-all-directories? #t
#:log-port (%make-void-port "w"))
- (let ((texmf.cnf (string-append
- #$output
- "/share/texmf-dist/web2c/texmf.cnf")))
- (when (file-exists? texmf.cnf)
- (substitute* texmf.cnf
- (("^TEXMFROOT = .*")
- (string-append "TEXMFROOT = " #$output "/share\n"))
- (("^TEXMF = .*")
- "TEXMF = $TEXMFROOT/share/texmf-dist\n"))
- ;; XXX: This is annoying, but it's necessary because texlive-bin
- ;; does not provide wrapped executables.
- (setenv "PATH"
- (string-append #$(file-append coreutils "/bin")
- ":"
- #$(file-append sed "/bin")))
- (setenv "PERL5LIB" #$(file-append texlive-bin "/share/tlpkg"))
- (setenv "TEXMF" (string-append #$output "/share/texmf-dist"))
+ ;; XXX: This is annoying, but it's necessary because texlive-bin
+ ;; does not provide wrapped executables.
+ (setenv "PATH"
+ (string-append #$(file-append coreutils "/bin")
+ ":"
+ #$(file-append sed "/bin")))
+ (setenv "PERL5LIB" #$(file-append texlive-bin "/share/tlpkg"))
+ (setenv "GUIX_TEXMF" "/tmp/texlive/share/texmf-dist")
- ;; Remove invalid maps from config file.
- (let* ((web2c (string-append #$output "/share/texmf-config/web2c/"))
- (maproot (string-append #$output "/share/texmf-dist/fonts/map/"))
- (updmap.cfg (string-append web2c "updmap.cfg")))
- (mkdir-p web2c)
+ ;; Remove invalid maps from config file.
+ (let* ((web2c (string-append #$output "/share/texmf-dist/web2c/"))
+ (maproot (string-append #$output "/share/texmf-dist/fonts/map/"))
+ (updmap.cfg (string-append web2c "updmap.cfg")))
+ (mkdir-p web2c)
+ (copy-file #$updmap.cfg updmap.cfg)
+ (make-file-writable updmap.cfg)
+ (let* ((port (open-pipe* OPEN_WRITE
+ #$(file-append texlive-bin "/bin/updmap-sys")
+ "--syncwithtrees"
+ "--nohash"
+ "--force"
+ (string-append "--cnffile=" updmap.cfg))))
+ (display "Y\n" port)
+ (when (not (zero? (status:exit-val (close-pipe port))))
+ (error "failed to filter updmap.cfg")))
- ;; Some profiles may already have this file, which prevents us
- ;; from copying it. Since we need to generate it from scratch
- ;; anyway, we delete it here.
- (when (file-exists? updmap.cfg)
- (delete-file updmap.cfg))
- (copy-file #$updmap.cfg updmap.cfg)
- (make-file-writable updmap.cfg)
- (let* ((port (open-pipe* OPEN_WRITE
- #$(file-append texlive-bin "/bin/updmap-sys")
- "--syncwithtrees"
- "--nohash"
- "--force"
- (string-append "--cnffile=" web2c "updmap.cfg"))))
- (display "Y\n" port)
- (when (not (zero? (status:exit-val (close-pipe port))))
- (error "failed to filter updmap.cfg")))
-
- ;; Generate font maps.
- (invoke #$(file-append texlive-bin "/bin/updmap-sys")
- (string-append "--cnffile=" web2c "updmap.cfg")
- (string-append "--dvipdfmxoutputdir="
- maproot "updmap/dvipdfmx/")
- (string-append "--dvipsoutputdir="
- maproot "updmap/dvips/")
- (string-append "--pdftexoutputdir="
- maproot "updmap/pdftex/")))))
- #t)))
+ ;; Generate font maps.
+ (invoke #$(file-append texlive-bin "/bin/updmap-sys")
+ (string-append "--cnffile=" updmap.cfg)
+ (string-append "--dvipdfmxoutputdir="
+ maproot "dvipdfmx/updmap")
+ (string-append "--dvipsoutputdir="
+ maproot "dvips/updmap")
+ (string-append "--pdftexoutputdir="
+ maproot "pdftex/updmap"))))))
(mlet %store-monad ((texlive-base (manifest-lookup-package manifest "texlive-base")))
(if texlive-base
- (gexp->derivation "texlive-configuration" build
+ (gexp->derivation "texlive-font-maps" build
#:substitutable? #f
#:local-build? #t
#:properties
`((type . profile-hook)
- (hook . texlive-configuration)))
+ (hook . texlive-font-maps)))
(return #f))))
(define %default-profile-hooks
@@ -1849,6 +1833,7 @@ MANIFEST."
glib-schemas
gtk-icon-themes
gtk-im-modules
+ texlive-font-maps
xdg-desktop-database
xdg-mime-database))
@@ -2037,9 +2022,14 @@ paths."
(make-regexp (string-append "^" (regexp-quote (basename profile))
"-([0-9]+)")))
-(define (generation-number profile)
- "Return PROFILE's number or 0. An absolute file name must be used."
- (or (and=> (false-if-exception (regexp-exec (profile-regexp profile)
+(define* (generation-number profile
+ #:optional (base-profile profile))
+ "Return PROFILE's number or 0. An absolute file name must be used.
+
+Optionally, if BASE-PROFILE is provided, use it instead of PROFILE to
+construct the regexp matching generations. This is useful in special cases
+like: (generation-number \"/run/current-system\" %system-profile)."
+ (or (and=> (false-if-exception (regexp-exec (profile-regexp base-profile)
(basename (readlink profile))))
(compose string->number (cut match:substring <> 1)))
0))