diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-12-09 22:29:01 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-12-10 00:24:02 +0100 |
commit | 78ed003811a38a7a3de56316755a2808b7d87e45 (patch) | |
tree | 82be5857976aef71f3a72c345e4768b93b094089 /gnu/system/shadow.scm | |
parent | 13ce0e3aa7c4803f35063cd1adcfa1279cc80dd5 (diff) |
gnu: Add 'inputs' field to <user-account>; make 'shell' a monadic value.
* gnu/system/shadow.scm (<user-account>)[inputs]: New field.
(passwd-file): Bind the 'shell' field of each account.
* gnu/system/vm.scm (%demo-operating-system): Remove 'shell' field.
* gnu/system/dmd.scm (guix-build-accounts): Store a monadic value in
'shell'. Add 'inputs' field.
* gnu/system.scm (operating-system-derivation): Remove 'shell' field for
'root' account. Add all the 'user-account-inputs' to EXTRAS.
Diffstat (limited to 'gnu/system/shadow.scm')
-rw-r--r-- | gnu/system/shadow.scm | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 2cc0b89162..ca24c3df2b 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -23,6 +23,7 @@ #:use-module (guix monads) #:use-module ((gnu packages system) #:select (shadow)) + #:use-module (gnu packages bash) #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:export (user-account @@ -34,6 +35,7 @@ user-account-comment user-account-home-directory user-account-shell + user-account-inputs user-group user-group? @@ -61,7 +63,9 @@ (gid user-account-gid) (comment user-account-comment (default "")) (home-directory user-account-home-directory) - (shell user-account-shell (default "/bin/sh"))) + (shell user-account-shell ; monadic value + (default (package-file bash "bin/bash"))) + (inputs user-account-inputs (default `(("bash" ,bash))))) (define-record-type* <user-group> user-group make-user-group @@ -93,26 +97,29 @@ SHADOW? is true, then it is a /etc/shadow file, otherwise it is a /etc/passwd file." ;; XXX: The resulting file is world-readable, so beware when SHADOW? is #t! - (define contents - (let loop ((accounts accounts) - (result '())) - (match accounts - ((($ <user-account> name pass uid gid comment home-dir shell) - rest ...) - (loop rest - (cons (if shadow? - (string-append name - ":" ; XXX: use (crypt PASS …)? - ":::::::") - (string-append name - ":" "x" - ":" (number->string uid) - ":" (number->string gid) - ":" comment ":" home-dir ":" shell)) - result))) - (() - (string-join (reverse result) "\n" 'suffix))))) + (define (contents) + (with-monad %store-monad + (let loop ((accounts accounts) + (result '())) + (match accounts + ((($ <user-account> name pass uid gid comment home-dir mshell) + rest ...) + (mlet %store-monad ((shell mshell)) + (loop rest + (cons (if shadow? + (string-append name + ":" ; XXX: use (crypt PASS …)? + ":::::::") + (string-append name + ":" "x" + ":" (number->string uid) + ":" (number->string gid) + ":" comment ":" home-dir ":" shell)) + result)))) + (() + (return (string-join (reverse result) "\n" 'suffix))))))) - (text-file (if shadow? "shadow" "passwd") contents)) + (mlet %store-monad ((contents (contents))) + (text-file (if shadow? "shadow" "passwd") contents))) ;;; shadow.scm ends here |