summary refs log tree commit diff
path: root/nixos/modules/services/x11/display-managers/sddm.nix
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2020-04-12 06:43:50 -0400
committerworldofpeace <worldofpeace@protonmail.ch>2020-07-09 21:15:35 -0400
commit490cd7889e3604d93187be54396b7114ce1bb0b5 (patch)
treefa6336125bb18ecc41de9f45fa6d03c190c46d9b /nixos/modules/services/x11/display-managers/sddm.nix
parentaba048f0bf2c5894fa431cdd7faf8406bd5dabde (diff)
downloadnixpkgs-490cd7889e3604d93187be54396b7114ce1bb0b5.tar
nixpkgs-490cd7889e3604d93187be54396b7114ce1bb0b5.tar.gz
nixpkgs-490cd7889e3604d93187be54396b7114ce1bb0b5.tar.bz2
nixpkgs-490cd7889e3604d93187be54396b7114ce1bb0b5.tar.lz
nixpkgs-490cd7889e3604d93187be54396b7114ce1bb0b5.tar.xz
nixpkgs-490cd7889e3604d93187be54396b7114ce1bb0b5.tar.zst
nixpkgs-490cd7889e3604d93187be54396b7114ce1bb0b5.zip
nixos/displayManager: make autoLogin options independent of DM type
Co-authored-by: volth <volth@volth.com>
Diffstat (limited to 'nixos/modules/services/x11/display-managers/sddm.nix')
-rw-r--r--nixos/modules/services/x11/display-managers/sddm.nix63
1 files changed, 23 insertions, 40 deletions
diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix
index 2f42271da87..e63bb2e4453 100644
--- a/nixos/modules/services/x11/display-managers/sddm.nix
+++ b/nixos/modules/services/x11/display-managers/sddm.nix
@@ -61,9 +61,9 @@ let
     EnableHidpi=${if cfg.enableHidpi then "true" else "false"}
     SessionDir=${dmcfg.sessionData.desktops}/share/wayland-sessions
 
-    ${optionalString cfg.autoLogin.enable ''
+    ${optionalString dmcfg.autoLogin.enable ''
     [Autologin]
-    User=${cfg.autoLogin.user}
+    User=${dmcfg.autoLogin.user}
     Session=${autoLoginSessionName}.desktop
     Relogin=${boolToString cfg.autoLogin.relogin}
     ''}
@@ -78,6 +78,20 @@ in
   imports = [
     (mkRemovedOptionModule [ "services" "xserver" "displayManager" "sddm" "themes" ]
       "Set the option `services.xserver.displayManager.sddm.package' instead.")
+    (mkRenamedOptionModule [ "services" "xserver" "displayManager" "sddm" "autoLogin" "enable" ] [
+      "services"
+      "xserver"
+      "displayManager"
+      "autoLogin"
+      "enable"
+    ])
+    (mkRenamedOptionModule [ "services" "xserver" "displayManager" "sddm" "autoLogin" "user" ] [
+      "services"
+      "xserver"
+      "displayManager"
+      "autoLogin"
+      "user"
+    ])
   ];
 
   options = {
@@ -153,40 +167,14 @@ in
         '';
       };
 
-      autoLogin = mkOption {
-        default = {};
+      # Configuration for automatic login specific to SDDM
+      autoLogin.relogin = mkOption {
+        type = types.bool;
+        default = false;
         description = ''
-          Configuration for automatic login.
+          If true automatic login will kick in again on session exit (logout), otherwise it
+          will only log in automatically when the display-manager is started.
         '';
-
-        type = types.submodule {
-          options = {
-            enable = mkOption {
-              type = types.bool;
-              default = false;
-              description = ''
-                Automatically log in as <option>autoLogin.user</option>.
-              '';
-            };
-
-            user = mkOption {
-              type = types.nullOr types.str;
-              default = null;
-              description = ''
-                User to be used for the automatic login.
-              '';
-            };
-
-            relogin = mkOption {
-              type = types.bool;
-              default = false;
-              description = ''
-                If true automatic login will kick in again on session exit (logout), otherwise it
-                will only log in automatically when the display-manager is started.
-              '';
-            };
-          };
-        };
       };
 
     };
@@ -201,12 +189,7 @@ in
           SDDM requires services.xserver.enable to be true
         '';
       }
-      { assertion = cfg.autoLogin.enable -> cfg.autoLogin.user != null;
-        message = ''
-          SDDM auto-login requires services.xserver.displayManager.sddm.autoLogin.user to be set
-        '';
-      }
-      { assertion = cfg.autoLogin.enable -> autoLoginSessionName != null;
+      { assertion = dmcfg.autoLogin.enable -> autoLoginSessionName != null;
         message = ''
           SDDM auto-login requires that services.xserver.displayManager.defaultSession is set.
         '';