summary refs log tree commit diff
path: root/nixos/modules/services/x11/display-managers/gdm.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/gdm.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/gdm.nix')
-rw-r--r--nixos/modules/services/x11/display-managers/gdm.nix65
1 files changed, 24 insertions, 41 deletions
diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix
index 622ea62f3a9..573049ab07a 100644
--- a/nixos/modules/services/x11/display-managers/gdm.nix
+++ b/nixos/modules/services/x11/display-managers/gdm.nix
@@ -37,6 +37,22 @@ let
 in
 
 {
+  imports = [
+    (mkRenamedOptionModule [ "services" "xserver" "displayManager" "gdm" "autoLogin" "enable" ] [
+      "services"
+      "xserver"
+      "displayManager"
+      "autoLogin"
+      "enable"
+    ])
+    (mkRenamedOptionModule [ "services" "xserver" "displayManager" "gdm" "autoLogin" "user" ] [
+      "services"
+      "xserver"
+      "displayManager"
+      "autoLogin"
+      "user"
+    ])
+  ];
 
   meta = {
     maintainers = teams.gnome.members;
@@ -56,40 +72,13 @@ in
         debugging messages in GDM
       '';
 
-      autoLogin = mkOption {
-        default = {};
+      # Auto login options specific to GDM
+      autoLogin.delay = mkOption {
+        type = types.int;
+        default = 0;
         description = ''
-          Auto login configuration attrset.
+          Seconds of inactivity after which the autologin will be performed.
         '';
-
-        type = types.submodule {
-          options = {
-            enable = mkOption {
-              type = types.bool;
-              default = false;
-              description = ''
-                Automatically log in as the sepecified <option>autoLogin.user</option>.
-              '';
-            };
-
-            user = mkOption {
-              type = types.nullOr types.str;
-              default = null;
-              description = ''
-                User to be used for the autologin.
-              '';
-            };
-
-            delay = mkOption {
-              type = types.int;
-              default = 0;
-              description = ''
-                Seconds of inactivity after which the autologin will be performed.
-              '';
-            };
-
-          };
-        };
       };
 
       wayland = mkOption {
@@ -128,12 +117,6 @@ in
 
   config = mkIf cfg.gdm.enable {
 
-    assertions = [
-      { assertion = cfg.gdm.autoLogin.enable -> cfg.gdm.autoLogin.user != null;
-        message = "GDM auto-login requires services.xserver.displayManager.gdm.autoLogin.user to be set";
-      }
-    ];
-
     services.xserver.displayManager.lightdm.enable = false;
 
     users.users.gdm =
@@ -287,14 +270,14 @@ in
     environment.etc."gdm/custom.conf".text = ''
       [daemon]
       WaylandEnable=${if cfg.gdm.wayland then "true" else "false"}
-      ${optionalString cfg.gdm.autoLogin.enable (
+      ${optionalString cfg.autoLogin.enable (
         if cfg.gdm.autoLogin.delay > 0 then ''
           TimedLoginEnable=true
-          TimedLogin=${cfg.gdm.autoLogin.user}
+          TimedLogin=${cfg.autoLogin.user}
           TimedLoginDelay=${toString cfg.gdm.autoLogin.delay}
         '' else ''
           AutomaticLoginEnable=true
-          AutomaticLogin=${cfg.gdm.autoLogin.user}
+          AutomaticLogin=${cfg.autoLogin.user}
         '')
       }