aboutsummaryrefslogtreecommitdiff
path: root/gnu/system/accounts.scm
blob: e37b733c6df69d55b5dd2a44bb7d2d10c41a9c25 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu system accounts)
  #:use-module (guix records)
  #:use-module (ice-9 match)
  #:export (<user-account>
            user-account
            user-account?
            user-account-name
            user-account-password
            user-account-uid
            user-account-group
            user-account-supplementary-groups
            user-account-comment
            user-account-home-directory
            user-account-create-home-directory?
            user-account-shell
            user-account-system?

            user-group
            user-group?
            user-group-name
            user-group-password
            user-group-id
            user-group-system?

            sexp->user-account
            sexp->user-group

            default-shell))


;;; Commentary:
;;;
;;; Data structures representing user accounts and user groups.  This is meant
;;; to be used both on the host side and at run time--e.g., in activation
;;; snippets.
;;;
;;; Code:

(define default-shell
  ;; Default shell for user accounts (a string or string-valued gexp).
  (make-parameter "/bin/sh"))

(define-record-type* <user-account>
  user-account make-user-account
  user-account?
  (name           user-account-name)
  (password       user-account-password (default #f))
  (uid            user-account-uid (default #f))
  (group          user-account-group)             ; number | string
  (supplementary-groups user-account-supplementary-groups
                        (default '()))            ; list of strings
  (comment        user-account-comment (default ""))
  (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
                  (default (default-shell)))
  (system?        user-account-system?            ; Boolean
                  (default #f)))

(define-record-type* <user-group>
  user-group make-user-group
  user-group?
  (name           user-group-name)
  (password       user-group-password (default #f))
  (id             user-group-id (default #f))
  (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."
  (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?)))))
88e9f3b2798c25fca35686174b4f3dd90b47'>gnu: lightdm-gtk-greeter: Set XCURSOR_PATH in wrapper....* gnu/packages/display-managers.scm (lightdm-gtk-greeter) [phases]{wrap-program}: Set XCURSOR_PATH to the current system share/icons. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> L p R n d n 2022-08-03gnu: lightdm-gtk-greeter: Disable indicator services....* gnu/packages/display-managers.scm (lightdm-gtk-greeter) [configure-flags]: Add '--disable-indicator-services-command'. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> L p R n d n 2022-08-03gnu: lightdm-gtk-greeter: Use gexps and new style inputs....* gnu/packages/display-managers.scm (lightdm-gtk-greeter)[arguments]: Use gexps. [configure-flags]: Use search-input-file. [phases]{fix-.desktop-file}: Likewise. {wrap-program}: Use search-input-file and this-package-input. [inputs]: Use new style. Add glib. Maxim Cournoyer 2022-08-03gnu: lightdm: Update to 1.32.0....* gnu/packages/display-managers.scm (lightdm): Update to 1.32.0. Maxim Cournoyer 2022-08-03gnu: lightdm: Enable XDMCP support....* gnu/packages/display-managers.scm (lightdm)[inputs]: Add libxdmcp. Maxim Cournoyer 2022-08-03gnu: lightdm: Build AccountsService files....* gnu/packages/display-managers.scm (lightdm) [native-inputs]: Add accountsservice. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> L p R n d n 2022-08-03gnu: lightdm: Install documentation....* gnu/packages/display-managers.scm (lightdm) [configure-flags]: Add --enable-gtk-doc. Maxim Cournoyer 2022-07-31gnu: qttools: Rename to qttools-5....Automated with: git grep -l qttools | xargs sed 's/\bqttools\b/\0-5/g' -i git checkout NEWS Maxim Cournoyer 2022-07-31gnu: qtquickcontrols2: Rename to qtquickcontrols2-5....Automated via: git grep -l qtquickcontrols2 | xargs sed 's/\bqtquickcontrols2\b/\0-5/g' -i git checkout NEWS Maxim Cournoyer 2022-07-31gnu: qtquickcontrols: Rename to qtquickcontrols-5....Automated via: git grep -l qtquickcontrols | xargs sed 's/\bqtquickcontrols\b/\0-5/g' -i git checkout NEWS Maxim Cournoyer 2022-07-31gnu: qtdeclarative: Rename to qtdeclarative-5....Automated via the following commands: git grep -l '\bqtdeclarative\b' | xargs sed -E 's/qtdeclarative/\0-5/g' -i git checkout NEWS Maxim Cournoyer 2022-07-31gnu: qtsvg: Rename variable to qtsvg-5....This is in preparation of the qtsvg update to version 6. This change was automated via the following command: git grep -l '\bqtsvg\b' | xargs sed 's/qtsvg/qtsvg-5/g' -i Maxim Cournoyer 2022-06-08gnu: lightdm: Fix build....This is a follow-up to commit 26876b66001a1dc45ee6d05015fddd7f5a88676e, migrate the package from Python 2 to Python 3 (but left some commented inputs for tests, breaking the build). * gnu/packages/display-managers.scm (lightdm)[native-inputs]: Un-comment python-wrapper and python-pygobject. Maxim Cournoyer 2022-05-31gnu: lightdm: Update to 1.30.0-0.b7fc321....* gnu/packages/display-managers.scm (lightdm): Update to 1.30.0-0.b7fc321. [source]: Use git. [configure-flags]: Add CFLAGS=-Wno-error=missing-prototypes. [phases]: Delete trailing #t. {fix-paths}: Use search-input-file. [inputs]: Add coreutils. [native-inputs]: Use new style. Replace python-2 by python-wrapper and python2-pygobject by python-pygobject. Add autoconf, automake, gtk-doc, libtool, which and yelp-tools. Maxim Cournoyer 2021-12-22gnu: Add sugar-light-sddm-theme....* gnu/packages/display-manager.scm (sugar-light-sddm-theme): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Petr Hodina 2021-12-22gnu: Add sugar-dark-sddm-theme....* gnu/packages/display-manager.scm (sugar-dark-sddm-theme): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Petr Hodina 2021-12-13gnu: Simplify package inputs....This commit was obtained by running: ./pre-inst-env guix style without any additional argument. Ludovic Courtès 2021-10-31Merge remote-tracking branch 'origin/master' into core-updates-frozenEfraim Flashner 2021-10-28gnu: lightdm-gtk-greeter: Add bash-minimal dependency....The bash-minimal dependency is required by the wrap-program, and guix lint suggests to add it in the inputs. * gnu/packages/display-managers.scm (lightdm): add bash-minimal dependency Signed-off-by: Ludovic Courtès <ludo@gnu.org> Denis 'GNUtoo' Carikli 2021-10-28gnu: lightdm-gtk-greeter: Update to 2.0.8...This also fixes the build. Before configure failed with the following error: checking for exo-csource... no configure: error: in `/tmp/guix-build-lightdm-gtk-greeter-2.0.7.drv-0/lightdm-gtk-greeter-2.0.7': configure: error: exo-csource not installed * gnu/packages/display-managers.scm (lightdm): update to 2.0.8 Signed-off-by: Ludovic Courtès <ludo@gnu.org> Denis 'GNUtoo' Carikli 2021-09-03gnu: sddm: Refer to the 'shadow' input....This change was suggested by Ludovic Courtès <ludo@gnu.org> to allow users to replace the shadow input in the package. * gnu/packages/display-manager.scm (sddm)[arguments]: In configure-flags refer to the shadow package that is an input. Efraim Flashner 2021-09-02gnu: sddm: Fix build....* gnu/packages/display-managers.scm (sddm)[arguments]: Use gexp for configure-flags. Efraim Flashner 2021-06-19Merge branch 'master' into core-updates...Note: this merge actually changes the 'curl' and 'python-attrs' derivations, as part of solving caf4a7a2770ef4d05a6e18f40d602e51da749ddc and 12964df69a99de6190422c752fef65ef813f3b6b respectively. 4604d43c0e (gnu: gnutls@3.6.16: Fix cross-compilation.) was ignored because it cannot currently be tested. Conflicts: gnu/local.mk gnu/packages/aidc.scm gnu/packages/boost.scm gnu/packages/curl.scm gnu/packages/nettle.scm gnu/packages/networking.scm gnu/packages/python-xyz.scm gnu/packages/tls.scm Marius Bakke 2021-06-14gnu: Rename qtbase to qtbase-5....This change was automated via the following command: $ git ls-files | xargs sed -i 's/,qtbase)/,qtbase-5)/g' $ git ls-files | xargs sed -i 's/inherit qtbase)/inherit qtbase-5)/g' $ git ls-files | xargs sed -i 's/package-version qtbase)/package-version qtbase-5)/g' $ git checkout etc # to clear some spurious changes This is done so the qtbase package can be upgraded to version 6 in the following commit. Maxim Cournoyer 2021-03-06Merge branch 'master' into core-updatesChristopher Baines 2021-02-25gnu: Add chili-sddm-theme....* gnu/packages/display-managers.scm (chili-sddm-theme): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Zheng Junjie 2021-02-01gnu: Adjust package collection to Wrap using GUIX_PYTHONPATH....This change was automated using: $ git ls-files | grep .scm | \ xargs sed 's/(getenv "PYTHONPATH")/(getenv "GUIX_PYTHONPATH")/' -i $ git ls-files | grep .scm | \ xargs sed 's/`("PYTHONPATH"/`("GUIX_PYTHONPATH"/' -i * gnu/packages/admin.scm (nmap): (dstat): Wrap using GUIX_PYTHONPATH. * gnu/packages/audio.scm (jack-2): (carla): Likewise. * gnu/packages/benchmark.scm (fio): Likewise. * gnu/packages/bioinformatics.scm (couger): Likewise. (gess, find-circ, filtlong, nanopolish): Likewise. * gnu/packages/cdrom.scm (cdemu-client): Likewise. * gnu/packages/chemistry.scm (avogadro): Likewise. * gnu/packages/connman.scm (econnman): Likewise. * gnu/packages/cups.scm (hplip): Likewise. * gnu/packages/debug.scm (scanmem): Likewise. * gnu/packages/display-managers.scm (lightdm): Likewise. * gnu/packages/ebook.scm (cozy): Likewise. * gnu/packages/education.scm (anki): Likewise. * gnu/packages/engineering.scm (kicad, volk, freecad): Likewise. * gnu/packages/game-development.scm (renpy): Likewise. * gnu/packages/games.scm (roguebox-adventures) (seahorse-adventures, kajongg): Likewise. * gnu/packages/gimp.scm (gimp, glimpse): Likewise. * gnu/packages/glib.scm (itstool): Likewise. * gnu/packages/gnome.scm (gnome-music, gtg, rhythmbox): Likewise. (eolie, d-feet, gedit, caribou, gnome-shell, authenticator) (gnome-todo, orca, passwordsafe, terminator, setzer) (libratbag, komikku): Likewise. * gnu/packages/gps.scm (gpsd): Likewise. * gnu/packages/gtk.scm (gtk-doc): Likewise. * gnu/packages/ibus.scm (ibus, ibus-libpinyin, ibus-anthy) (ibus-libhangul): Likewise. * gnu/packages/inkscape.scm (inkscape-1.0): Likewise. * gnu/packages/linux.scm (bcc): Likewise. * gnu/packages/mail.scm (notifymuch): Likewise. * gnu/packages/maths.scm (units): Likewise. * gnu/packages/music.scm (solfege): Likewise. * gnu/packages/networking.scm (blueman): Likewise. * gnu/packages/patchutils.scm (patchwork): Likewise. * gnu/packages/photo.scm (rapid-photo-downloader, entangle): Likewise. * gnu/packages/plotutils.scm (asymptote): Likewise. * gnu/packages/presentation.scm (presentty): Likewise. * gnu/packages/screen.scm (byobu): Likewise. * gnu/packages/storage.scm (ceph): Likewise. * gnu/packages/syndication.scm (liferea): Likewise. * gnu/packages/task-management.scm (blanket): Likewise. * gnu/packages/text-editors.scm (manuskript): Likewise. * gnu/packages/version-control.scm (gitless, cgit, git-when-merged) (git-imerge): Likewise. * gnu/packages/video.scm (pitivi): Likewise. * gnu/packages/virtualization.scm (criu): Likewise. * gnu/packages/xfce.scm (catfish): Likewise. Maxim Cournoyer