nixos/sddm: add display manager
This commit is contained in:
parent
c532beeb0d
commit
db5b08cfaf
@ -180,6 +180,7 @@
|
|||||||
panamax = 170;
|
panamax = 170;
|
||||||
marathon = 171;
|
marathon = 171;
|
||||||
exim = 172;
|
exim = 172;
|
||||||
|
sddm = 175;
|
||||||
|
|
||||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||||
|
|
||||||
@ -322,6 +323,7 @@
|
|||||||
exim = 172;
|
exim = 172;
|
||||||
fleet = 173;
|
fleet = 173;
|
||||||
input = 174;
|
input = 174;
|
||||||
|
sddm = 175;
|
||||||
|
|
||||||
# When adding a gid, make sure it doesn't match an existing
|
# When adding a gid, make sure it doesn't match an existing
|
||||||
# uid. Users and groups with the same name should have equal
|
# uid. Users and groups with the same name should have equal
|
||||||
|
@ -359,6 +359,7 @@
|
|||||||
./services/x11/display-managers/gdm.nix
|
./services/x11/display-managers/gdm.nix
|
||||||
./services/x11/display-managers/kdm.nix
|
./services/x11/display-managers/kdm.nix
|
||||||
./services/x11/display-managers/lightdm.nix
|
./services/x11/display-managers/lightdm.nix
|
||||||
|
./services/x11/display-managers/sddm.nix
|
||||||
./services/x11/display-managers/slim.nix
|
./services/x11/display-managers/slim.nix
|
||||||
./services/x11/hardware/multitouch.nix
|
./services/x11/hardware/multitouch.nix
|
||||||
./services/x11/hardware/synaptics.nix
|
./services/x11/hardware/synaptics.nix
|
||||||
|
108
nixos/modules/services/x11/display-managers/sddm.nix
Normal file
108
nixos/modules/services/x11/display-managers/sddm.nix
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
xcfg = config.services.xserver;
|
||||||
|
dmcfg = xcfg.displayManager;
|
||||||
|
cfg = dmcfg.sddm;
|
||||||
|
xEnv = config.systemd.services."display-manager".environment;
|
||||||
|
|
||||||
|
xserverWrapper = pkgs.writeScript "xserver-wrapper" ''
|
||||||
|
#!/bin/sh
|
||||||
|
${concatMapStrings (n: "export ${n}=\"${getAttr n xEnv}\"\n") (attrNames xEnv)}
|
||||||
|
exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs} "$@"
|
||||||
|
'';
|
||||||
|
|
||||||
|
cfgFile = pkgs.writeText "sddm.conf" ''
|
||||||
|
[General]
|
||||||
|
HaltCommand=${pkgs.systemd}/bin/systemctl poweroff
|
||||||
|
RebootCommand=${pkgs.systemd}/bin/systemctl reboot
|
||||||
|
|
||||||
|
[Theme]
|
||||||
|
Current=${cfg.theme}
|
||||||
|
|
||||||
|
[Users]
|
||||||
|
MaximumUid=${toString config.ids.uids.nixbld}
|
||||||
|
|
||||||
|
[XDisplay]
|
||||||
|
MinimumVT=${toString xcfg.tty}
|
||||||
|
ServerPath=${xserverWrapper}
|
||||||
|
XephyrPath=${pkgs.xorg.xorgserver}/bin/Xephyr
|
||||||
|
SessionCommand=${dmcfg.session.script}
|
||||||
|
SessionDir=${dmcfg.session.desktops}
|
||||||
|
XauthPath=${pkgs.xorg.xauth}/bin/xauth
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.xserver.displayManager.sddm = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable sddm as the display manager.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
theme = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "maui";
|
||||||
|
description = ''
|
||||||
|
Greeter theme to use.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
services.xserver.displayManager.slim.enable = false;
|
||||||
|
|
||||||
|
services.xserver.displayManager.job = {
|
||||||
|
logsXsession = true;
|
||||||
|
|
||||||
|
#execCmd = "${pkgs.sddm}/bin/sddm";
|
||||||
|
execCmd = "exec ${pkgs.sddm}/bin/sddm";
|
||||||
|
};
|
||||||
|
|
||||||
|
security.pam.services = {
|
||||||
|
sddm = {
|
||||||
|
allowNullPassword = true;
|
||||||
|
startSession = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
sddm-greeter.text = ''
|
||||||
|
auth required pam_succeed_if.so audit quiet_success user = sddm
|
||||||
|
auth optional pam_permit.so
|
||||||
|
|
||||||
|
account required pam_succeed_if.so audit quiet_success user = sddm
|
||||||
|
account sufficient pam_unix.so
|
||||||
|
|
||||||
|
password required pam_deny.so
|
||||||
|
|
||||||
|
session required pam_succeed_if.so audit quiet_success user = sddm
|
||||||
|
session required pam_env.so envfile=${config.system.build.pamEnvironment}
|
||||||
|
session optional ${pkgs.systemd}/lib/security/pam_systemd.so
|
||||||
|
session optional pam_keyinit.so force revoke
|
||||||
|
session optional pam_permit.so
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
users.extraUsers.sddm = {
|
||||||
|
createHome = true;
|
||||||
|
home = "/var/lib/sddm";
|
||||||
|
group = "sddm";
|
||||||
|
uid = config.ids.uids.sddm;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.etc."sddm.conf".source = cfgFile;
|
||||||
|
|
||||||
|
users.extraGroups.sddm.gid = config.ids.gids.sddm;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user