2018-07-20 22:56:59 +02:00
|
|
|
{ config, lib, ... }:
|
2010-01-05 16:32:14 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
dmcfg = config.services.xserver.displayManager;
|
2020-01-26 23:41:19 +01:00
|
|
|
cfg = config.test-support.displayManager.auto;
|
2010-01-05 16:32:14 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
2020-01-26 23:41:19 +01:00
|
|
|
test-support.displayManager.auto = {
|
2023-04-30 16:26:16 +02:00
|
|
|
enable = lib.mkOption {
|
2010-01-05 16:32:14 +01:00
|
|
|
default = false;
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2010-01-05 16:32:14 +01:00
|
|
|
Whether to enable the fake "auto" display manager, which
|
|
|
|
automatically logs in the user specified in the
|
|
|
|
{option}`user` option. This is mostly useful for
|
|
|
|
automated tests.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-04-30 16:26:16 +02:00
|
|
|
user = lib.mkOption {
|
2010-01-05 16:32:14 +01:00
|
|
|
default = "root";
|
2024-04-13 14:54:15 +02:00
|
|
|
description = "The user account to login automatically.";
|
2010-01-05 16:32:14 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2023-04-30 16:26:16 +02:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-02-27 21:28:05 +01:00
|
|
|
services.xserver.displayManager.lightdm.enable = true;
|
|
|
|
services.displayManager.autoLogin = {
|
|
|
|
enable = true;
|
|
|
|
user = cfg.user;
|
2012-10-24 12:31:02 +02:00
|
|
|
};
|
2010-01-05 16:32:14 +01:00
|
|
|
|
2018-09-02 08:13:24 +02:00
|
|
|
# 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
|
|
|
|
'';
|
2010-01-05 16:32:14 +01:00
|
|
|
};
|
|
|
|
}
|