diff options
Diffstat (limited to 'nixos/modules/services/x11/display-managers/sddm.nix')
-rw-r--r-- | nixos/modules/services/x11/display-managers/sddm.nix | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix index ae947a5d2d4..6b344822977 100644 --- a/nixos/modules/services/x11/display-managers/sddm.nix +++ b/nixos/modules/services/x11/display-managers/sddm.nix @@ -17,6 +17,16 @@ let exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs} "$@" ''; + Xsetup = pkgs.writeScript "Xsetup" '' + #!/bin/sh + ${cfg.setupScript} + ''; + + Xstop = pkgs.writeScript "Xstop" '' + #!/bin/sh + ${cfg.stopScript} + ''; + cfgFile = pkgs.writeText "sddm.conf" '' [General] HaltCommand=${pkgs.systemd}/bin/systemctl poweroff @@ -39,6 +49,8 @@ let SessionCommand=${dmcfg.session.script} SessionDir=${dmcfg.session.desktops} XauthPath=${pkgs.xorg.xauth}/bin/xauth + DisplayCommand=${Xsetup} + DisplayStopCommand=${Xstop} ${optionalString cfg.autoLogin.enable '' [Autologin] @@ -98,6 +110,27 @@ in ''; }; + setupScript = mkOption { + type = types.str; + default = ""; + example = '' + # workaround for using NVIDIA Optimus without Bumblebee + xrandr --setprovideroutputsource modesetting NVIDIA-0 + xrandr --auto + ''; + description = '' + A script to execute when starting the display server. + ''; + }; + + stopScript = mkOption { + type = types.str; + default = ""; + description = '' + A script to execute when stopping the display server. + ''; + }; + autoLogin = mkOption { default = {}; description = '' @@ -105,7 +138,7 @@ in ''; type = types.submodule { - options = { + options = { enable = mkOption { type = types.bool; default = false; @@ -130,7 +163,7 @@ in will work only the first time. ''; }; - }; + }; }; }; @@ -142,14 +175,16 @@ in assertions = [ { assertion = cfg.autoLogin.enable -> cfg.autoLogin.user != null; - message = "SDDM auto-login requires services.xserver.displayManager.sddm.autoLogin.user to be set"; + message = '' + SDDM auto-login requires services.xserver.displayManager.sddm.autoLogin.user to be set + ''; } { assertion = cfg.autoLogin.enable -> elem defaultSessionName dmcfg.session.names; message = '' SDDM auto-login requires that services.xserver.desktopManager.default and - services.xserver.windowMananger.default are set to valid values. The current - default session: ${defaultSessionName} is not valid. - ''; + services.xserver.windowMananger.default are set to valid values. The current + default session: ${defaultSessionName} is not valid. + ''; } ]; |