aboutsummaryrefslogtreecommitdiff
path: root/gnu/system/accounts.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/system/accounts.scm')
-rw-r--r--gnu/system/accounts.scm28
1 files changed, 28 insertions, 0 deletions
diff --git a/gnu/system/accounts.scm b/gnu/system/accounts.scm
index 36ee62e851..eb18fb5e43 100644
--- a/gnu/system/accounts.scm
+++ b/gnu/system/accounts.scm
@@ -18,6 +18,7 @@
(define-module (gnu system accounts)
#:use-module (guix records)
+ #:use-module (ice-9 match)
#:export (user-account
user-account?
user-account-name
@@ -38,6 +39,9 @@
user-group-id
user-group-system?
+ sexp->user-account
+ sexp->user-group
+
default-shell))
@@ -79,3 +83,27 @@
(id user-group-id (default #f))
(system? user-group-system? ; Boolean
(default #f)))
+
+(define (sexp->user-group sexp)
+ "Take SEXP, a tuple as returned by 'user-group->gexp', and turn it into a
+user-group record."
+ (match sexp
+ ((name password id system?)
+ (user-group (name name)
+ (password password)
+ (id id)
+ (system? system?)))))
+
+(define (sexp->user-account sexp)
+ "Take SEXP, a tuple as returned by 'user-account->gexp', and turn it into a
+user-account record."
+ (match sexp
+ ((name uid group supplementary-groups comment home-directory
+ create-home-directory? shell password system?)
+ (user-account (name name) (uid uid) (group group)
+ (supplementary-groups supplementary-groups)
+ (comment comment)
+ (home-directory home-directory)
+ (create-home-directory? create-home-directory?)
+ (shell shell) (password password)
+ (system? system?)))))