summary refs log tree commit diff
path: root/nixos/tests/common/auto.nix
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2020-01-26 17:41:19 -0500
committerworldofpeace <worldofpeace@protonmail.ch>2020-01-29 19:05:46 -0500
commitc95612a5a2d4bd93011c042066c6c3deacfd436d (patch)
tree08448c24e08d760bd8a7717af60a15a0bbf7d547 /nixos/tests/common/auto.nix
parent7adffb14cd129e919ccba8a7a285d409065d4357 (diff)
downloadnixpkgs-c95612a5a2d4bd93011c042066c6c3deacfd436d.tar
nixpkgs-c95612a5a2d4bd93011c042066c6c3deacfd436d.tar.gz
nixpkgs-c95612a5a2d4bd93011c042066c6c3deacfd436d.tar.bz2
nixpkgs-c95612a5a2d4bd93011c042066c6c3deacfd436d.tar.lz
nixpkgs-c95612a5a2d4bd93011c042066c6c3deacfd436d.tar.xz
nixpkgs-c95612a5a2d4bd93011c042066c6c3deacfd436d.tar.zst
nixpkgs-c95612a5a2d4bd93011c042066c6c3deacfd436d.zip
nixos/display-managers/auto: remove
This module allows root autoLogin, so we would break that for users, but
they shouldn't be using it anyways. This gives the impression like auto
is some special display manager, when it's just lightdm and special pam
rules to allow root autoLogin. It was created for NixOS's testing
so I believe this is where it belongs.
Diffstat (limited to 'nixos/tests/common/auto.nix')
-rw-r--r--nixos/tests/common/auto.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/nixos/tests/common/auto.nix b/nixos/tests/common/auto.nix
new file mode 100644
index 00000000000..2c21a8d5167
--- /dev/null
+++ b/nixos/tests/common/auto.nix
@@ -0,0 +1,68 @@
+{ config, lib, ... }:
+
+with lib;
+
+let
+
+  dmcfg = config.services.xserver.displayManager;
+  cfg = config.test-support.displayManager.auto;
+
+in
+
+{
+
+  ###### interface
+
+  options = {
+
+    test-support.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
+    '';
+
+  };
+
+}