summaryrefslogtreecommitdiff
path: root/gnu/system/shadow.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-03-25 16:53:55 +0100
committerLudovic Courtès <ludo@gnu.org>2025-04-20 18:50:51 +0200
commitda741d89310efd0530351670d9c55ec2f952ab98 (patch)
tree1d5a1f16f41c62e23f08f94252f53cddb9c35dd3 /gnu/system/shadow.scm
parentc990405607f3692420ed94e75a7046feff3e28ce (diff)
services: account: Create /var/guix/profiles/per-user/$USER.
* gnu/system/shadow.scm (account-shepherd-service): Create /var/guix/profiles/per-user/$USER in ‘user-homes’ service. Change-Id: I22e66e8a34d63686df9bae64c68df65c8889e72a
Diffstat (limited to 'gnu/system/shadow.scm')
-rw-r--r--gnu/system/shadow.scm19
1 files changed, 18 insertions, 1 deletions
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index b68a8188719..d0f1b6b2b14 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013-2020, 2022, 2023 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2013-2020, 2022-2023, 2025 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2016 Alex Griffin <a@ajgrf.com> 3;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
4;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> 4;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
5;;; Copyright © 2020, 2023 Efraim Flashner <efraim@flashner.co.il> 5;;; Copyright © 2020, 2023 Efraim Flashner <efraim@flashner.co.il>
@@ -460,6 +460,12 @@ accounts among ACCOUNTS+GROUPS."
460 (define accounts 460 (define accounts
461 (filter user-account? accounts+groups)) 461 (filter user-account? accounts+groups))
462 462
463 (define regular-account-names
464 (filter-map (lambda (account)
465 (and (not (user-account-system? account))
466 (user-account-name account)))
467 accounts))
468
463 ;; Create home directories only once 'file-systems' is up. This makes sure 469 ;; Create home directories only once 'file-systems' is up. This makes sure
464 ;; they are created in the right place if /home lives on a separate 470 ;; they are created in the right place if /home lives on a separate
465 ;; partition. 471 ;; partition.
@@ -480,6 +486,17 @@ accounts among ACCOUNTS+GROUPS."
480 (activate-user-home 486 (activate-user-home
481 (map sexp->user-account 487 (map sexp->user-account
482 (list #$@(map user-account->gexp accounts)))) 488 (list #$@(map user-account->gexp accounts))))
489
490 ;; Create the user's profile directory upfront:
491 ;; guix-daemon lacks permissions to create it when it is
492 ;; running as an unprivileged user.
493 (for-each (lambda (account)
494 (let ((profile (in-vicinity
495 "/var/guix/profiles/per-user"
496 account))
497 (owner (getpwnam account)))
498 (mkdir-p/perms profile owner #o755)))
499 '#$regular-account-names)
483 #t))) ;success 500 #t))) ;success
484 (documentation "Create user home directories.")))) 501 (documentation "Create user home directories."))))
485 502