2018-07-20 22:56:59 +02:00
|
|
|
{ config, lib, ... }:
|
2010-01-05 16:32:14 +01:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with 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 = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2020-01-26 23:41:19 +01:00
|
|
|
test-support.displayManager.auto = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-01-05 16:32:14 +01:00
|
|
|
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 {
|
|
|
|
|
2018-08-20 14:25:25 +02:00
|
|
|
services.xserver.displayManager.lightdm = {
|
2012-10-24 12:31:02 +02:00
|
|
|
enable = true;
|
2018-08-20 14:25:25 +02:00
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|