file-systems: Convey hint via '&fix-hint'.
[jackhill/guix/guix.git] / gnu / system / shadow.scm
index 4e5b6ae..a69339b 100644 (file)
@@ -1,6 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,7 +34,6 @@
   #:use-module ((gnu packages admin)
                 #:select (shadow))
   #:use-module (gnu packages bash)
-  #:use-module (gnu packages guile-wm)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
 (define (default-skeletons)
   "Return the default skeleton files for /etc/skel.  These files are copied by
 'useradd' in the home directory of newly created user accounts."
-  (define copy-guile-wm
-    (with-imported-modules '((guix build utils))
-      #~(begin
-          (use-modules (guix build utils))
-          (copy-file (car (find-files #+guile-wm "wm-init-sample.scm"))
-                     #$output))))
 
   (let ((profile (plain-file "bash_profile" "\
 # Honor per-interactive-shell startup file
@@ -162,7 +157,6 @@ alias grep='grep --color=auto'\n"))
         (zprofile    (plain-file "zprofile" "\
 # Honor system-wide environment variables
 source /etc/profile\n"))
-        (guile-wm  (computed-file "guile-wm" copy-guile-wm))
         (xdefaults (plain-file "Xdefaults" "\
 XTerm*utf8: always
 XTerm*metaSendsEscape: true\n"))
@@ -202,7 +196,6 @@ convenient interactive line editing and input history.\\n\\n\")))
               (else
                (display \"Consider installing the 'guile-colorized' package
 for a colorful Guile experience.\\n\\n\"))))\n"))
-      (".guile-wm" ,guile-wm)
       (".gdbinit" ,gdbinit))))
 
 (define (skeleton-directory skeletons)
@@ -223,6 +216,10 @@ for a colorful Guile experience.\\n\\n\"))))\n"))
                                    ((target source)
                                     (copy-recursively source target)))
                                  '#$skeletons)
+                       ;; Make nanorc respect XDG_CONFIG_HOME.
+                       (when (file-exists? ".nanorc")
+                         (mkdir-p ".config/nano")
+                         (rename-file ".nanorc" ".config/nano/nanorc"))
                        #t))))
 
 (define (assert-valid-users/groups users groups)
@@ -302,8 +299,6 @@ group."
     #~(begin
         (use-modules (gnu system accounts))
 
-        (setenv "PATH"
-                (string-append #$(@ (gnu packages admin) shadow) "/sbin"))
         (activate-users+groups (map sexp->user-account (list #$@user-specs))
                                (map sexp->user-group (list #$@group-specs))))))
 
@@ -319,12 +314,11 @@ accounts among ACCOUNTS+GROUPS."
   ;;
   ;; XXX: We arrange for this service to stop right after it's done its job so
   ;; that 'guix system reconfigure' knows that it can reload it fearlessly
-  ;; (and thus create new home directories).  The cost of this hack is that
-  ;; there's a small window during which first-time logins could happen before
-  ;; the home directory has been created.
+  ;; (and thus create new home directories).
   (list (shepherd-service
          (requirement '(file-systems))
          (provision '(user-homes))
+         (one-shot? #t)
          (modules '((gnu build activation)
                     (gnu system accounts)))
          (start (with-imported-modules (source-module-closure
@@ -334,9 +328,7 @@ accounts among ACCOUNTS+GROUPS."
                       (activate-user-home
                        (map sexp->user-account
                             (list #$@(map user-account->gexp accounts))))
-                      #f)))                       ;stop
-         (stop #~(const #f))
-         (respawn? #f)
+                      #t)))                       ;success
          (documentation "Create user home directories."))))
 
 (define (shells-file shells)
@@ -380,8 +372,16 @@ the /etc/skel directory for those."
                                           account-activation)
                        (service-extension shepherd-root-service-type
                                           account-shepherd-service)
+                       ;; Have 'user-processes' depend on 'user-homes' so that
+                       ;; daemons start after their home directory has been
+                       ;; created.
+                       (service-extension user-processes-service-type
+                                          (const '(user-homes)))
                        (service-extension etc-service-type
-                                          etc-files)))))
+                                          etc-files)))
+                (description
+                 "Ensure the specified user accounts and groups exist, as well
+as each account home directory.")))
 
 (define (account-service accounts+groups skeletons)
   "Return a <service> that takes care of user accounts and user groups, with