summaryrefslogtreecommitdiff
path: root/gnu/system/accounts.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-03-22 14:06:54 +0100
committerLudovic Courtès <ludo@gnu.org>2019-03-25 23:37:06 +0100
commitcf848cc0a17a3a58d600116896f6e7abfb0440d4 (patch)
tree72dc8bed055908e869ce8737360c9352dd1618a0 /gnu/system/accounts.scm
parentabd4d6b33dba4de228e90ad15a8efb456fcf7b6e (diff)
accounts: Add default value for the 'home-directory' field of <user-account>.
* gnu/system/accounts.scm (<user-account>)[home-directory]: Mark as thunked and add a default value. (default-home-directory): New procedure. * doc/guix.texi (User Accounts): Remove 'home-directory' from example. * gnu/system/examples/bare-bones.tmpl: Likewise. * gnu/system/examples/beaglebone-black.tmpl: Likewise. * gnu/system/examples/desktop.tmpl: Likewise. * gnu/system/examples/docker-image.tmpl: Likewise. * gnu/system/examples/lightweight-desktop.tmpl: Likewise. * gnu/system/install.scm (installation-os): Likewise. * gnu/tests.scm (%simple-os): Likewise. * gnu/tests/install.scm (%minimal-os, %minimal-os-on-vda): (%separate-home-os, %encrypted-root-os, %btrfs-root-os): Likewise. * tests/accounts.scm ("allocate-passwd") ("allocate-passwd with previous state"): Likewise.
Diffstat (limited to 'gnu/system/accounts.scm')
-rw-r--r--gnu/system/accounts.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/gnu/system/accounts.scm b/gnu/system/accounts.scm
index eb18fb5e43..586cff1842 100644
--- a/gnu/system/accounts.scm
+++ b/gnu/system/accounts.scm
@@ -67,7 +67,8 @@
(supplementary-groups user-account-supplementary-groups
(default '())) ; list of strings
(comment user-account-comment (default ""))
- (home-directory user-account-home-directory)
+ (home-directory user-account-home-directory (thunked)
+ (default (default-home-directory this-record)))
(create-home-directory? user-account-create-home-directory? ;Boolean
(default #t))
(shell user-account-shell ; gexp
@@ -84,6 +85,10 @@
(system? user-group-system? ; Boolean
(default #f)))
+(define (default-home-directory account)
+ "Return the default home directory for ACCOUNT."
+ (string-append "/home/" (user-account-name account)))
+
(define (sexp->user-group sexp)
"Take SEXP, a tuple as returned by 'user-group->gexp', and turn it into a
user-group record."