diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2019-03-22 14:06:54 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2019-03-25 23:37:06 +0100 |
| commit | cf848cc0a17a3a58d600116896f6e7abfb0440d4 (patch) | |
| tree | 72dc8bed055908e869ce8737360c9352dd1618a0 | |
| parent | abd4d6b33dba4de228e90ad15a8efb456fcf7b6e (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.
| -rw-r--r-- | doc/guix.texi | 1 | ||||
| -rw-r--r-- | gnu/system/accounts.scm | 7 | ||||
| -rw-r--r-- | gnu/system/examples/bare-bones.tmpl | 3 | ||||
| -rw-r--r-- | gnu/system/examples/beaglebone-black.tmpl | 3 | ||||
| -rw-r--r-- | gnu/system/examples/desktop.tmpl | 3 | ||||
| -rw-r--r-- | gnu/system/examples/docker-image.tmpl | 3 | ||||
| -rw-r--r-- | gnu/system/examples/lightweight-desktop.tmpl | 3 | ||||
| -rw-r--r-- | gnu/system/install.scm | 3 | ||||
| -rw-r--r-- | gnu/tests.scm | 5 | ||||
| -rw-r--r-- | gnu/tests/install.scm | 14 | ||||
| -rw-r--r-- | tests/accounts.scm | 4 |
11 files changed, 18 insertions, 31 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 63405bcf49a..37fef405226 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -10927,7 +10927,6 @@ this field must contain the encrypted password, as a string. You can use the | |||
| 10927 | @example | 10927 | @example |
| 10928 | (user-account | 10928 | (user-account |
| 10929 | (name "charlie") | 10929 | (name "charlie") |
| 10930 | (home-directory "/home/charlie") | ||
| 10931 | (group "users") | 10930 | (group "users") |
| 10932 | 10931 | ||
| 10933 | ;; Specify a SHA-512-hashed initial password. | 10932 | ;; Specify a SHA-512-hashed initial password. |
diff --git a/gnu/system/accounts.scm b/gnu/system/accounts.scm index eb18fb5e43f..586cff1842e 100644 --- a/gnu/system/accounts.scm +++ b/gnu/system/accounts.scm | |||
| @@ -67,7 +67,8 @@ | |||
| 67 | (supplementary-groups user-account-supplementary-groups | 67 | (supplementary-groups user-account-supplementary-groups |
| 68 | (default '())) ; list of strings | 68 | (default '())) ; list of strings |
| 69 | (comment user-account-comment (default "")) | 69 | (comment user-account-comment (default "")) |
| 70 | (home-directory user-account-home-directory) | 70 | (home-directory user-account-home-directory (thunked) |
| 71 | (default (default-home-directory this-record))) | ||
| 71 | (create-home-directory? user-account-create-home-directory? ;Boolean | 72 | (create-home-directory? user-account-create-home-directory? ;Boolean |
| 72 | (default #t)) | 73 | (default #t)) |
| 73 | (shell user-account-shell ; gexp | 74 | (shell user-account-shell ; gexp |
| @@ -84,6 +85,10 @@ | |||
| 84 | (system? user-group-system? ; Boolean | 85 | (system? user-group-system? ; Boolean |
| 85 | (default #f))) | 86 | (default #f))) |
| 86 | 87 | ||
| 88 | (define (default-home-directory account) | ||
| 89 | "Return the default home directory for ACCOUNT." | ||
| 90 | (string-append "/home/" (user-account-name account))) | ||
| 91 | |||
| 87 | (define (sexp->user-group sexp) | 92 | (define (sexp->user-group sexp) |
| 88 | "Take SEXP, a tuple as returned by 'user-group->gexp', and turn it into a | 93 | "Take SEXP, a tuple as returned by 'user-group->gexp', and turn it into a |
| 89 | user-group record." | 94 | user-group record." |
diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl index a88bab034fa..4f30a5b7561 100644 --- a/gnu/system/examples/bare-bones.tmpl +++ b/gnu/system/examples/bare-bones.tmpl | |||
| @@ -35,8 +35,7 @@ | |||
| 35 | ;; and "video" allows the user to play sound | 35 | ;; and "video" allows the user to play sound |
| 36 | ;; and access the webcam. | 36 | ;; and access the webcam. |
| 37 | (supplementary-groups '("wheel" | 37 | (supplementary-groups '("wheel" |
| 38 | "audio" "video")) | 38 | "audio" "video"))) |
| 39 | (home-directory "/home/alice")) | ||
| 40 | %base-user-accounts)) | 39 | %base-user-accounts)) |
| 41 | 40 | ||
| 42 | ;; Globally-installed packages. | 41 | ;; Globally-installed packages. |
diff --git a/gnu/system/examples/beaglebone-black.tmpl b/gnu/system/examples/beaglebone-black.tmpl index 11678063b2c..def05e807d3 100644 --- a/gnu/system/examples/beaglebone-black.tmpl +++ b/gnu/system/examples/beaglebone-black.tmpl | |||
| @@ -38,8 +38,7 @@ | |||
| 38 | ;; and "video" allows the user to play sound | 38 | ;; and "video" allows the user to play sound |
| 39 | ;; and access the webcam. | 39 | ;; and access the webcam. |
| 40 | (supplementary-groups '("wheel" | 40 | (supplementary-groups '("wheel" |
| 41 | "audio" "video")) | 41 | "audio" "video"))) |
| 42 | (home-directory "/home/alice")) | ||
| 43 | %base-user-accounts)) | 42 | %base-user-accounts)) |
| 44 | 43 | ||
| 45 | ;; Globally-installed packages. | 44 | ;; Globally-installed packages. |
diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl index c59bf926815..bc5cbd6e6b2 100644 --- a/gnu/system/examples/desktop.tmpl +++ b/gnu/system/examples/desktop.tmpl | |||
| @@ -42,8 +42,7 @@ | |||
| 42 | (comment "Alice's brother") | 42 | (comment "Alice's brother") |
| 43 | (group "users") | 43 | (group "users") |
| 44 | (supplementary-groups '("wheel" "netdev" | 44 | (supplementary-groups '("wheel" "netdev" |
| 45 | "audio" "video")) | 45 | "audio" "video"))) |
| 46 | (home-directory "/home/bob")) | ||
| 47 | %base-user-accounts)) | 46 | %base-user-accounts)) |
| 48 | 47 | ||
| 49 | ;; This is where we specify system-wide packages. | 48 | ;; This is where we specify system-wide packages. |
diff --git a/gnu/system/examples/docker-image.tmpl b/gnu/system/examples/docker-image.tmpl index 9690d651c12..ca633cc838c 100644 --- a/gnu/system/examples/docker-image.tmpl +++ b/gnu/system/examples/docker-image.tmpl | |||
| @@ -15,8 +15,7 @@ | |||
| 15 | (comment "Bob's sister") | 15 | (comment "Bob's sister") |
| 16 | (group "users") | 16 | (group "users") |
| 17 | (supplementary-groups '("wheel" | 17 | (supplementary-groups '("wheel" |
| 18 | "audio" "video")) | 18 | "audio" "video"))) |
| 19 | (home-directory "/home/alice")) | ||
| 20 | %base-user-accounts)) | 19 | %base-user-accounts)) |
| 21 | 20 | ||
| 22 | ;; Globally-installed packages. | 21 | ;; Globally-installed packages. |
diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl index a234badd2be..45d9bf447f4 100644 --- a/gnu/system/examples/lightweight-desktop.tmpl +++ b/gnu/system/examples/lightweight-desktop.tmpl | |||
| @@ -35,8 +35,7 @@ | |||
| 35 | (comment "Bob's sister") | 35 | (comment "Bob's sister") |
| 36 | (group "users") | 36 | (group "users") |
| 37 | (supplementary-groups '("wheel" "netdev" | 37 | (supplementary-groups '("wheel" "netdev" |
| 38 | "audio" "video")) | 38 | "audio" "video"))) |
| 39 | (home-directory "/home/alice")) | ||
| 40 | %base-user-accounts)) | 39 | %base-user-accounts)) |
| 41 | 40 | ||
| 42 | ;; Add a bunch of window managers; we can choose one at | 41 | ;; Add a bunch of window managers; we can choose one at |
diff --git a/gnu/system/install.scm b/gnu/system/install.scm index bad318d06bc..aad1deb9136 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm | |||
| @@ -379,8 +379,7 @@ You have been warned. Thanks for being so brave.\x1b[0m | |||
| 379 | (group "users") | 379 | (group "users") |
| 380 | (supplementary-groups '("wheel")) ; allow use of sudo | 380 | (supplementary-groups '("wheel")) ; allow use of sudo |
| 381 | (password "") | 381 | (password "") |
| 382 | (comment "Guest of GNU") | 382 | (comment "Guest of GNU")))) |
| 383 | (home-directory "/home/guest")))) | ||
| 384 | 383 | ||
| 385 | (issue %issue) | 384 | (issue %issue) |
| 386 | (services %installation-services) | 385 | (services %installation-services) |
diff --git a/gnu/tests.scm b/gnu/tests.scm index 9e8eed7d950..0871b4c6f77 100644 --- a/gnu/tests.scm +++ b/gnu/tests.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> | 3 | ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> |
| 4 | ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> | 4 | ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> |
| 5 | ;;; | 5 | ;;; |
| @@ -219,8 +219,7 @@ the system under test." | |||
| 219 | (name "alice") | 219 | (name "alice") |
| 220 | (comment "Bob's sister") | 220 | (comment "Bob's sister") |
| 221 | (group "users") | 221 | (group "users") |
| 222 | (supplementary-groups '("wheel" "audio" "video")) | 222 | (supplementary-groups '("wheel" "audio" "video"))) |
| 223 | (home-directory "/home/alice")) | ||
| 224 | %base-user-accounts)))) | 223 | %base-user-accounts)))) |
| 225 | 224 | ||
| 226 | (define-syntax-rule (simple-operating-system user-services ...) | 225 | (define-syntax-rule (simple-operating-system user-services ...) |
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 277908cc49e..c0debbd840e 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm | |||
| @@ -74,8 +74,7 @@ | |||
| 74 | (name "alice") | 74 | (name "alice") |
| 75 | (comment "Bob's sister") | 75 | (comment "Bob's sister") |
| 76 | (group "users") | 76 | (group "users") |
| 77 | (supplementary-groups '("wheel" "audio" "video")) | 77 | (supplementary-groups '("wheel" "audio" "video"))) |
| 78 | (home-directory "/home/alice")) | ||
| 79 | %base-user-accounts)) | 78 | %base-user-accounts)) |
| 80 | (services (cons (service marionette-service-type | 79 | (services (cons (service marionette-service-type |
| 81 | (marionette-configuration | 80 | (marionette-configuration |
| @@ -357,8 +356,7 @@ per %test-installed-os, this test is expensive in terms of CPU and storage.") | |||
| 357 | (name "alice") | 356 | (name "alice") |
| 358 | (comment "Bob's sister") | 357 | (comment "Bob's sister") |
| 359 | (group "users") | 358 | (group "users") |
| 360 | (supplementary-groups '("wheel" "audio" "video")) | 359 | (supplementary-groups '("wheel" "audio" "video"))) |
| 361 | (home-directory "/home/alice")) | ||
| 362 | %base-user-accounts)) | 360 | %base-user-accounts)) |
| 363 | (services (cons (service marionette-service-type | 361 | (services (cons (service marionette-service-type |
| 364 | (marionette-configuration | 362 | (marionette-configuration |
| @@ -435,12 +433,10 @@ reboot\n") | |||
| 435 | %base-file-systems)) | 433 | %base-file-systems)) |
| 436 | (users (cons* (user-account | 434 | (users (cons* (user-account |
| 437 | (name "alice") | 435 | (name "alice") |
| 438 | (group "users") | 436 | (group "users")) |
| 439 | (home-directory "/home/alice")) | ||
| 440 | (user-account | 437 | (user-account |
| 441 | (name "charlie") | 438 | (name "charlie") |
| 442 | (group "users") | 439 | (group "users")) |
| 443 | (home-directory "/home/charlie")) | ||
| 444 | %base-user-accounts)) | 440 | %base-user-accounts)) |
| 445 | (services (cons (service marionette-service-type | 441 | (services (cons (service marionette-service-type |
| 446 | (marionette-configuration | 442 | (marionette-configuration |
| @@ -655,7 +651,6 @@ by 'mdadm'.") | |||
| 655 | (users (cons (user-account | 651 | (users (cons (user-account |
| 656 | (name "charlie") | 652 | (name "charlie") |
| 657 | (group "users") | 653 | (group "users") |
| 658 | (home-directory "/home/charlie") | ||
| 659 | (supplementary-groups '("wheel" "audio" "video"))) | 654 | (supplementary-groups '("wheel" "audio" "video"))) |
| 660 | %base-user-accounts)) | 655 | %base-user-accounts)) |
| 661 | (services (cons (service marionette-service-type | 656 | (services (cons (service marionette-service-type |
| @@ -776,7 +771,6 @@ build (current-guix) and then store a couple of full system images.") | |||
| 776 | (users (cons (user-account | 771 | (users (cons (user-account |
| 777 | (name "charlie") | 772 | (name "charlie") |
| 778 | (group "users") | 773 | (group "users") |
| 779 | (home-directory "/home/charlie") | ||
| 780 | (supplementary-groups '("wheel" "audio" "video"))) | 774 | (supplementary-groups '("wheel" "audio" "video"))) |
| 781 | %base-user-accounts)) | 775 | %base-user-accounts)) |
| 782 | (services (cons (service marionette-service-type | 776 | (services (cons (service marionette-service-type |
diff --git a/tests/accounts.scm b/tests/accounts.scm index 127861042d2..923ba7dc839 100644 --- a/tests/accounts.scm +++ b/tests/accounts.scm | |||
| @@ -199,12 +199,10 @@ nobody:!:0::::::\n")) | |||
| 199 | (directory "/var/empty"))) | 199 | (directory "/var/empty"))) |
| 200 | (allocate-passwd (list (user-account (name "alice") | 200 | (allocate-passwd (list (user-account (name "alice") |
| 201 | (comment "Alice") | 201 | (comment "Alice") |
| 202 | (home-directory "/home/alice") | ||
| 203 | (shell "/bin/sh") | 202 | (shell "/bin/sh") |
| 204 | (group "users")) | 203 | (group "users")) |
| 205 | (user-account (name "bob") | 204 | (user-account (name "bob") |
| 206 | (comment "Bob") | 205 | (comment "Bob") |
| 207 | (home-directory "/home/bob") | ||
| 208 | (shell "/bin/gash") | 206 | (shell "/bin/gash") |
| 209 | (group "wheel")) | 207 | (group "wheel")) |
| 210 | (user-account (name "sshd") (system? #t) | 208 | (user-account (name "sshd") (system? #t) |
| @@ -234,12 +232,10 @@ nobody:!:0::::::\n")) | |||
| 234 | (directory "/home/charlie"))) | 232 | (directory "/home/charlie"))) |
| 235 | (allocate-passwd (list (user-account (name "alice") | 233 | (allocate-passwd (list (user-account (name "alice") |
| 236 | (comment "Alice") | 234 | (comment "Alice") |
| 237 | (home-directory "/home/alice") | ||
| 238 | (shell "/bin/sh") ;ignored | 235 | (shell "/bin/sh") ;ignored |
| 239 | (group "users")) | 236 | (group "users")) |
| 240 | (user-account (name "charlie") | 237 | (user-account (name "charlie") |
| 241 | (comment "Charlie") | 238 | (comment "Charlie") |
| 242 | (home-directory "/home/charlie") | ||
| 243 | (shell "/bin/sh") | 239 | (shell "/bin/sh") |
| 244 | (group "users"))) | 240 | (group "users"))) |
| 245 | (list (group-entry (name "users") (gid 1000))) | 241 | (list (group-entry (name "users") (gid 1000))) |
