summary refs log tree commit diff
path: root/nixos/modules/services/x11/display-managers/gdm.nix
diff options
context:
space:
mode:
authorLuca Bruno <lethalman88@gmail.com>2015-08-27 18:11:09 +0200
committerLuca Bruno <lethalman88@gmail.com>2015-08-27 18:11:39 +0200
commit6eb096900f143bc85f725890f76a3ab7ceca6751 (patch)
treef8485645bd3f3dfb253296f13184e105350ef447 /nixos/modules/services/x11/display-managers/gdm.nix
parent52d7550da317001c4015e4b1edd1d359dabe7d91 (diff)
downloadnixpkgs-6eb096900f143bc85f725890f76a3ab7ceca6751.tar
nixpkgs-6eb096900f143bc85f725890f76a3ab7ceca6751.tar.gz
nixpkgs-6eb096900f143bc85f725890f76a3ab7ceca6751.tar.bz2
nixpkgs-6eb096900f143bc85f725890f76a3ab7ceca6751.tar.lz
nixpkgs-6eb096900f143bc85f725890f76a3ab7ceca6751.tar.xz
nixpkgs-6eb096900f143bc85f725890f76a3ab7ceca6751.tar.zst
nixpkgs-6eb096900f143bc85f725890f76a3ab7ceca6751.zip
nixos gdm: support autologin
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, 56 insertions, 9 deletions
diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix
index 6c3c5273086..245c18ee2d9 100644
--- a/nixos/modules/services/x11/display-managers/gdm.nix
+++ b/nixos/modules/services/x11/display-managers/gdm.nix
@@ -18,14 +18,42 @@ in
 
     services.xserver.displayManager.gdm = {
 
-      enable = mkOption {
-        type = types.bool;
-        default = false;
-        example = true;
-        description = ''
-          Whether to enable GDM as the display manager.
-          <emphasis>GDM is very experimental and may render system unusable.</emphasis>
-        '';
+      enable = mkEnableOption ''
+        Whether to enable GDM as the display manager.
+        <emphasis>GDM is very experimental and may render system unusable.</emphasis>
+      '';
+
+      autoLogin = mkOption {
+        default = {};
+
+        type = types.submodule {
+          options = {
+            enable = mkOption {
+              type = types.bool;
+              default = false;
+              description = ''
+                Automatically log in as the sepecified <option>auto.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.
+              '';
+            };
+
+          };
+        };
       };
 
     };
@@ -71,6 +99,25 @@ in
 
     programs.dconf.profiles.gdm = "${gdm}/share/dconf/profile/gdm";
 
+    environment.etc."gdm/custom.conf".text = ''
+      [daemon]
+      ${optionalString cfg.gdm.autoLogin.enable ''
+      TimedLoginEnable=true
+      TimedLogin=${cfg.gdm.autoLogin.user}
+      TimedLoginDelay=${toString cfg.gdm.autoLogin.delay}
+      ''}
+
+      [security]
+
+      [xdmcp]
+
+      [greeter]
+
+      [chooser]
+
+      [debug]
+    '';
+
     # GDM LFS PAM modules, adapted somehow to NixOS
     security.pam.services = {
       gdm-launch-environment.text = ''
@@ -89,7 +136,7 @@ in
         session  optional       pam_permit.so
       '';
 
-     gdm.text = ''
+      gdm.text = ''
         auth     requisite      pam_nologin.so
         auth     required       pam_env.so