aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-27 18:57:33 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-27 19:06:08 +0200
commit459dd9eaf2ded3bd5676af7e62892db2c7880758 (patch)
treef393be707acffa51a2a3370678a32c98a6f8a169 /guix
parentf2c403eab62513c88b27ec3e4db5130a476c06ca (diff)
downloadgnu-guix-459dd9eaf2ded3bd5676af7e62892db2c7880758.tar
gnu-guix-459dd9eaf2ded3bd5676af7e62892db2c7880758.tar.gz
system: Add a 'system?' field to user accounts.
* gnu/system/shadow.scm (<user-account>)[system?]: New field. * gnu/system.scm (user-account->gexp): Add it. * guix/build/activation.scm (add-user): Add #:system? parameter and honor it. (activate-users+groups): Handle the 'system?' part of user tuples. Pass it to 'add-user'. Don't create PROFILE-DIR when SYSTEM? is true. * gnu/services/dbus.scm (dbus-service): Add 'system?' field for "messagebus" account. * gnu/services/base.scm (guix-build-accounts): Likewise. * gnu/services/avahi.scm (avahi-service): Likewise.
Diffstat (limited to 'guix')
-rw-r--r--guix/build/activation.scm15
1 files changed, 9 insertions, 6 deletions
diff --git a/guix/build/activation.scm b/guix/build/activation.scm
index 12c1ca142d..9464d2157d 100644
--- a/guix/build/activation.scm
+++ b/guix/build/activation.scm
@@ -47,7 +47,7 @@
(zero? (apply system* "groupadd" args))))
(define* (add-user name group
- #:key uid comment home shell password
+ #:key uid comment home shell password system?
(supplementary-groups '())
(log-port (current-error-port)))
"Create an account for user NAME part of GROUP, with the specified
@@ -82,6 +82,7 @@ properties. Return #t on success."
'())
,@(if shell `("-s" ,shell) '())
,@(if password `("-p" ,password) '())
+ ,@(if system? '("--system") '())
,name)))
(zero? (apply system* "useradd" args)))))
@@ -97,22 +98,24 @@ numeric gid or #f."
(define activate-user
(match-lambda
- ((name uid group supplementary-groups comment home shell password)
+ ((name uid group supplementary-groups comment home shell password system?)
(unless (false-if-exception (getpwnam name))
(let ((profile-dir (string-append "/var/guix/profiles/per-user/"
name)))
(add-user name group
#:uid uid
+ #:system? system?
#:supplementary-groups supplementary-groups
#:comment comment
#:home home
#:shell shell
#:password password)
- ;; Create the profile directory for the new account.
- (let ((pw (getpwnam name)))
- (mkdir-p profile-dir)
- (chown profile-dir (passwd:uid pw) (passwd:gid pw))))))))
+ (unless system?
+ ;; Create the profile directory for the new account.
+ (let ((pw (getpwnam name)))
+ (mkdir-p profile-dir)
+ (chown profile-dir (passwd:uid pw) (passwd:gid pw)))))))))
;; 'groupadd' aborts if the file doesn't already exist.
(touch "/etc/group")