diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-10-03 21:30:30 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-10-03 23:12:20 +0200 |
commit | d9f0a23704a038640329fae6e2273e5813cdb8ab (patch) | |
tree | 149b6f0d423e8261dc59580a54b8f4f9b37f26a6 /gnu/system/linux.scm | |
parent | b860f382447a360ea2ce8a89d3357279cc652c3a (diff) | |
download | guix-d9f0a23704a038640329fae6e2273e5813cdb8ab.tar guix-d9f0a23704a038640329fae6e2273e5813cdb8ab.tar.gz |
gnu: vm: Rewrite helper functions as monadic functions.
* gnu/system/dmd.scm (host-name-service, nscd-service, mingetty-service,
syslog-service, guix-service, static-networking-service): Rewrite as
monadic functions.
(dmd-configuration-file): Use 'text-file' instead of
'add-text-to-store'.
* gnu/system/grub.scm (grub-configuration-file): Rewrite as a monadic
function.
* gnu/system/linux.scm (pam-services->directory): Likewise.
* gnu/system/shadow.scm (group-file, passwd-file, guix-build-accounts):
Likewise.
* gnu/system/vm.scm (expression->derivation-in-linux-vm, qemu-image,
union, system-qemu-image): Likewise.
Diffstat (limited to 'gnu/system/linux.scm')
-rw-r--r-- | gnu/system/linux.scm | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gnu/system/linux.scm b/gnu/system/linux.scm index 6aebe159ba..eb3e133044 100644 --- a/gnu/system/linux.scm +++ b/gnu/system/linux.scm @@ -20,6 +20,7 @@ #:use-module (guix store) #:use-module (guix records) #:use-module (guix derivations) + #:use-module (guix monads) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) @@ -81,17 +82,20 @@ (map (cut entry->string "password" <>) password) (map (cut entry->string "session" <>) session)))))) -(define (pam-services->directory store services) +(define (pam-services->directory services) "Return the derivation to build the configuration directory to be used as /etc/pam.d for SERVICES." - (let ((names (map pam-service-name services)) - (files (map (match-lambda + (mlet %store-monad + ((names -> (map pam-service-name services)) + (files (mapm %store-monad + (match-lambda ((and service ($ <pam-service> name)) (let ((config (pam-service->configuration service))) - (add-text-to-store store - (string-append name ".pam") - config '())))) - services))) + (text-file (string-append name ".pam") config)))) + + ;; XXX: Eventually, SERVICES may be a list of monadic + ;; values instead of plain values. + (map return services)))) (define builder '(begin (use-modules (ice-9 match)) @@ -104,9 +108,7 @@ %build-inputs) #t))) - (build-expression->derivation store "pam.d" (%current-system) - builder - (zip names files)))) + (derivation-expression "pam.d" (%current-system) builder (zip names files)))) (define %pam-other-services ;; The "other" PAM configuration, which denies everything (see |