aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/services/x11/display-managers/auto.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/services/x11/display-managers/auto.nix')
-rw-r--r--nixpkgs/nixos/modules/services/x11/display-managers/auto.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/x11/display-managers/auto.nix b/nixpkgs/nixos/modules/services/x11/display-managers/auto.nix
new file mode 100644
index 00000000000..1068a344e0c
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/x11/display-managers/auto.nix
@@ -0,0 +1,68 @@
+{ config, lib, ... }:
+
+with lib;
+
+let
+
+ dmcfg = config.services.xserver.displayManager;
+ cfg = dmcfg.auto;
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.xserver.displayManager.auto = {
+
+ enable = mkOption {
+ default = false;
+ description = ''
+ Whether to enable the fake "auto" display manager, which
+ automatically logs in the user specified in the
+ <option>user</option> option. This is mostly useful for
+ automated tests.
+ '';
+ };
+
+ user = mkOption {
+ default = "root";
+ description = "The user account to login automatically.";
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ services.xserver.displayManager.lightdm = {
+ enable = true;
+ autoLogin = {
+ enable = true;
+ user = cfg.user;
+ };
+ };
+
+ # lightdm by default doesn't allow auto login for root, which is
+ # required by some nixos tests. Override it here.
+ security.pam.services.lightdm-autologin.text = lib.mkForce ''
+ auth requisite pam_nologin.so
+ auth required pam_succeed_if.so quiet
+ auth required pam_permit.so
+
+ account include lightdm
+
+ password include lightdm
+
+ session include lightdm
+ '';
+
+ };
+
+}