me
/
guix
Archived
1
0
Fork 0

profiles: Use 'with-imported-modules'.

* guix/profiles.scm (info-dir-file): Use 'with-imported-modules' instead
of the #:module argument to 'gexp->derivation'.
(ghc-package-cache-file): Likewise.
(ca-certificate-bundle): Likewise.
(gtk-icon-themes): Likewise.
(xdg-desktop-database): Likewise.
(xdg-mime-database): Likewise.
(profile-derivation): Likewise.
master
Ludovic Courtès 2016-07-12 00:54:22 +02:00
parent a91c3fc727
commit 99b231dee6
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 189 additions and 189 deletions

View File

@ -489,6 +489,7 @@ MANIFEST."
(module-ref (resolve-interface '(gnu packages compression)) 'gzip))
(define build
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils)
(srfi srfi-1) (srfi srfi-26)
@ -512,10 +513,9 @@ MANIFEST."
(mkdir-p (string-append #$output "/share/info"))
(exit (every install-info
(append-map info-files
'#$(manifest-inputs manifest))))))
'#$(manifest-inputs manifest)))))))
(gexp->derivation "info-dir" build
#:modules '((guix build utils))
#:local-build? #t
#:substitutable? #f))
@ -526,6 +526,7 @@ entries of MANIFEST, or #f if MANIFEST does not have any GHC packages."
(module-ref (resolve-interface '(gnu packages haskell)) 'ghc))
(define build
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils)
(srfi srfi-1) (srfi srfi-26)
@ -562,14 +563,13 @@ entries of MANIFEST, or #f if MANIFEST does not have any GHC packages."
(system* (string-append #+ghc "/bin/ghc-pkg") "recache"
(string-append "--package-db=" db-dir)))))
(for-each delete-file (find-files db-dir "\\.conf$"))
(exit success))))
(exit success)))))
(with-monad %store-monad
;; Don't depend on GHC when there's nothing to do.
(if (any (cut string-prefix? "ghc" <>)
(map manifest-entry-name (manifest-entries manifest)))
(gexp->derivation "ghc-package-cache" build
#:modules '((guix build utils))
#:local-build? #t
#:substitutable? #f)
(return #f))))
@ -585,6 +585,7 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx."
(module-ref (resolve-interface '(gnu packages base)) 'glibc-utf8-locales))
(define build
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils)
(rnrs io ports)
@ -633,10 +634,9 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx."
(concatenate-files ca-files
(string-append result
"/ca-certificates.crt"))
#t)))))
#t))))))
(gexp->derivation "ca-certificate-bundle" build
#:modules '((guix build utils))
#:local-build? #t
#:substitutable? #f))
@ -645,6 +645,11 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx."
creates the GTK+ 'icon-theme.cache' file for each theme."
(mlet %store-monad ((gtk+ (manifest-lookup-package manifest "gtk+")))
(define build
(with-imported-modules '((guix build utils)
(guix build union)
(guix build profiles)
(guix search-paths)
(guix records))
#~(begin
(use-modules (guix build utils)
(guix build union)
@ -673,16 +678,11 @@ creates the GTK+ 'icon-theme.cache' file for each theme."
(when (file-is-directory? dir)
(ensure-writable-directory dir)
(system* update-icon-cache "-t" dir "--quiet"))))
(scandir destdir (negate (cut member <> '("." ".."))))))))
(scandir destdir (negate (cut member <> '("." "..")))))))))
;; Don't run the hook when there's nothing to do.
(if gtk+
(gexp->derivation "gtk-icon-themes" build
#:modules '((guix build utils)
(guix build union)
(guix build profiles)
(guix search-paths)
(guix records))
#:local-build? #t
#:substitutable? #f)
(return #f))))
@ -695,6 +695,8 @@ MIME type."
(manifest-lookup-package
manifest "desktop-file-utils")))
(define build
(with-imported-modules '((guix build utils)
(guix build union))
#~(begin
(use-modules (srfi srfi-26)
(guix build utils)
@ -710,13 +712,11 @@ MIME type."
(mkdir-p (string-append #$output "/share"))
(union-build destdir appdirs
#:log-port (%make-void-port "w"))
(exit (zero? (system* update-desktop-database destdir))))))
(exit (zero? (system* update-desktop-database destdir)))))))
;; Don't run the hook when 'desktop-file-utils' is not referenced.
(if desktop-file-utils
(gexp->derivation "xdg-desktop-database" build
#:modules '((guix build utils)
(guix build union))
#:local-build? #t
#:substitutable? #f)
(return #f))))
@ -728,6 +728,8 @@ entries. It's used to query the MIME type of a given file."
(manifest-lookup-package
manifest "shared-mime-info")))
(define build
(with-imported-modules '((guix build utils)
(guix build union))
#~(begin
(use-modules (srfi srfi-26)
(guix build utils)
@ -745,13 +747,11 @@ entries. It's used to query the MIME type of a given file."
(union-build (string-append destdir "/packages") pkgdirs
#:log-port (%make-void-port "w"))
(setenv "XDG_DATA_HOME" datadir)
(exit (zero? (system* update-mime-database destdir))))))
(exit (zero? (system* update-mime-database destdir)))))))
;; Don't run the hook when 'shared-mime-info' is referenced.
(if shared-mime-info
(gexp->derivation "xdg-mime-database" build
#:modules '((guix build utils)
(guix build union))
#:local-build? #t
#:substitutable? #f)
(return #f))))
@ -790,6 +790,11 @@ the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc."
(manifest-inputs manifest)))
(define builder
(with-imported-modules '((guix build profiles)
(guix build union)
(guix build utils)
(guix search-paths)
(guix records))
#~(begin
(use-modules (guix build profiles)
(guix search-paths)
@ -809,15 +814,10 @@ the monadic procedures listed in HOOKS--such as an Info 'dir' file, etc."
(build-profile #$output '#$inputs
#:manifest '#$(manifest->gexp manifest)
#:search-paths search-paths)))
#:search-paths search-paths))))
(gexp->derivation "profile" builder
#:system system
#:modules '((guix build profiles)
(guix build union)
(guix build utils)
(guix search-paths)
(guix records))
;; Not worth offloading.
#:local-build? #t