locale: Demonadify the locale creation API.

* gnu/system/locale.scm (single-locale-directory): Use 'computed-file'
instead of 'gexp->derivation'.
(locale-directory): Adjust accordingly and do the same.
* gnu/system.scm (operating-system-directory-base-entries): Adjust
accordingly.
This commit is contained in:
Ludovic Courtès 2017-07-17 23:38:23 +02:00
parent 6d833b13b7
commit b19a49d015
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 23 additions and 26 deletions

View File

@ -403,7 +403,8 @@ OS."
(define* (operating-system-directory-base-entries os #:key container?) (define* (operating-system-directory-base-entries os #:key container?)
"Return the basic entries of the 'system' directory of OS for use as the "Return the basic entries of the 'system' directory of OS for use as the
value of the SYSTEM-SERVICE-TYPE service." value of the SYSTEM-SERVICE-TYPE service."
(mlet %store-monad ((locale (operating-system-locale-directory os))) (let ((locale (operating-system-locale-directory os)))
(with-monad %store-monad
(if container? (if container?
(return `(("locale" ,locale))) (return `(("locale" ,locale)))
(mlet %store-monad (mlet %store-monad
@ -413,7 +414,7 @@ value of the SYSTEM-SERVICE-TYPE service."
(return `(("kernel" ,kernel) (return `(("kernel" ,kernel)
("parameters" ,params) ("parameters" ,params)
("initrd" ,initrd) ("initrd" ,initrd)
("locale" ,locale))))))) ;used by libc ("locale" ,locale)))))))) ;used by libc
(define* (essential-services os #:key container?) (define* (essential-services os #:key container?)
"Return the list of essential services for OS. These are special services "Return the list of essential services for OS. These are special services

View File

@ -19,7 +19,6 @@
(define-module (gnu system locale) (define-module (gnu system locale)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix monads)
#:use-module (guix records) #:use-module (guix records)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (gnu packages base) #:use-module (gnu packages base)
@ -118,8 +117,7 @@ of LIBC."
(and #$@(map (cut localedef-command <> #:libc libc) (and #$@(map (cut localedef-command <> #:libc libc)
locales))))) locales)))))
(gexp->derivation (string-append "locale-" version) build (computed-file (string-append "locale-" version) build))
#:local-build? #t))
(define* (locale-directory locales (define* (locale-directory locales
#:key (libcs %default-locale-libcs)) #:key (libcs %default-locale-libcs))
@ -133,18 +131,16 @@ data format changes between libc versions."
((libc) ((libc)
(single-locale-directory locales #:libc libc)) (single-locale-directory locales #:libc libc))
((libcs ..1) ((libcs ..1)
(mlet %store-monad ((dirs (mapm %store-monad (let ((dirs (map (lambda (libc)
(lambda (libc) (single-locale-directory locales #:libc libc))
(single-locale-directory locales
#:libc libc))
libcs))) libcs)))
(gexp->derivation "locale-multiple-versions" (computed-file "locale-multiple-versions"
(with-imported-modules '((guix build union)) (with-imported-modules '((guix build union))
#~(begin #~(begin
(use-modules (guix build union)) (use-modules (guix build union))
(union-build #$output (list #$@dirs)))) (union-build #$output (list #$@dirs))))
#:local-build? #t #:options '(#:local-build? #t
#:substitutable? #f))))) #:substitutable? #f))))))
(define %default-locale-libcs (define %default-locale-libcs
;; The libcs for which we build locales by default. ;; The libcs for which we build locales by default.