git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/sddm: add display manager
commitdb5b08cfaf88568e815af6c8a9a3e60122a5f3d8 authorNikolay Amiantov <ab@fmap.me> dateMon 2 Mar 2015, 20:58 (12 years ago) parentc532bee
3 files changed+111
nixos/modules/misc/ids.nix+2 nixos/modules/module-list.nix+1 nixos/modules/services/x11/display-managers/sddm.nix+108
nixos/modules/misc/ids.nix+2
@@ -180,6 +180,7 @@
180180 panamax = 170;
181181 marathon = 171;
182182 exim = 172;
183+ sddm = 175;
183184
184185 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
185186
@@ -322,6 +323,7 @@
322323 exim = 172;
323324 fleet = 173;
324325 input = 174;
326+ sddm = 175;
325327
326328 # When adding a gid, make sure it doesn't match an existing
327329 # uid. Users and groups with the same name should have equal
nixos/modules/module-list.nix+1
@@ -359,6 +359,7 @@
359359 ./services/x11/display-managers/gdm.nix
360360 ./services/x11/display-managers/kdm.nix
361361 ./services/x11/display-managers/lightdm.nix
362+ ./services/x11/display-managers/sddm.nix
362363 ./services/x11/display-managers/slim.nix
363364 ./services/x11/hardware/multitouch.nix
364365 ./services/x11/hardware/synaptics.nix
nixos/modules/services/x11/display-managers/sddm.nixnew file+108
@@ -0,0 +1,108 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+
7+ xcfg = config.services.xserver;
8+ dmcfg = xcfg.displayManager;
9+ cfg = dmcfg.sddm;
10+ xEnv = config.systemd.services."display-manager".environment;
11+
12+ xserverWrapper = pkgs.writeScript "xserver-wrapper" ''
13+ #!/bin/sh
14+ ${concatMapStrings (n: "export ${n}=\"${getAttr n xEnv}\"\n") (attrNames xEnv)}
15+ exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs} "$@"
16+ '';
17+
18+ cfgFile = pkgs.writeText "sddm.conf" ''
19+ [General]
20+ HaltCommand=${pkgs.systemd}/bin/systemctl poweroff
21+ RebootCommand=${pkgs.systemd}/bin/systemctl reboot
22+
23+ [Theme]
24+ Current=${cfg.theme}
25+
26+ [Users]
27+ MaximumUid=${toString config.ids.uids.nixbld}
28+
29+ [XDisplay]
30+ MinimumVT=${toString xcfg.tty}
31+ ServerPath=${xserverWrapper}
32+ XephyrPath=${pkgs.xorg.xorgserver}/bin/Xephyr
33+ SessionCommand=${dmcfg.session.script}
34+ SessionDir=${dmcfg.session.desktops}
35+ XauthPath=${pkgs.xorg.xauth}/bin/xauth
36+ '';
37+
38+in
39+{
40+ options = {
41+
42+ services.xserver.displayManager.sddm = {
43+ enable = mkOption {
44+ type = types.bool;
45+ default = false;
46+ description = ''
47+ Whether to enable sddm as the display manager.
48+ '';
49+ };
50+
51+ theme = mkOption {
52+ type = types.str;
53+ default = "maui";
54+ description = ''
55+ Greeter theme to use.
56+ '';
57+ };
58+ };
59+
60+ };
61+
62+ config = mkIf cfg.enable {
63+
64+ services.xserver.displayManager.slim.enable = false;
65+
66+ services.xserver.displayManager.job = {
67+ logsXsession = true;
68+
69+ #execCmd = "${pkgs.sddm}/bin/sddm";
70+ execCmd = "exec ${pkgs.sddm}/bin/sddm";
71+ };
72+
73+ security.pam.services = {
74+ sddm = {
75+ allowNullPassword = true;
76+ startSession = true;
77+ };
78+
79+ sddm-greeter.text = ''
80+ auth required pam_succeed_if.so audit quiet_success user = sddm
81+ auth optional pam_permit.so
82+
83+ account required pam_succeed_if.so audit quiet_success user = sddm
84+ account sufficient pam_unix.so
85+
86+ password required pam_deny.so
87+
88+ session required pam_succeed_if.so audit quiet_success user = sddm
89+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
90+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
91+ session optional pam_keyinit.so force revoke
92+ session optional pam_permit.so
93+ '';
94+ };
95+
96+ users.extraUsers.sddm = {
97+ createHome = true;
98+ home = "/var/lib/sddm";
99+ group = "sddm";
100+ uid = config.ids.uids.sddm;
101+ };
102+
103+ environment.etc."sddm.conf".source = cfgFile;
104+
105+ users.extraGroups.sddm.gid = config.ids.gids.sddm;
106+
107+ };
108+}