2018-07-20 20:56:59 +00:00
|
|
|
{ config, lib, ... }:
|
2010-01-05 15:32:14 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2010-01-05 15:32:14 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
dmcfg = config.services.xserver.displayManager;
|
2020-01-26 22:41:19 +00:00
|
|
|
cfg = config.test-support.displayManager.auto;
|
2010-01-05 15:32:14 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2020-01-26 22:41:19 +00:00
|
|
|
test-support.displayManager.auto = {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2010-01-05 15:32:14 +00: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 {
|
|
|
|
|
2020-04-12 10:43:50 +00:00
|
|
|
services.xserver.displayManager = {
|
|
|
|
lightdm.enable = true;
|
2018-08-20 12:25:25 +00:00
|
|
|
autoLogin = {
|
|
|
|
enable = true;
|
|
|
|
user = cfg.user;
|
|
|
|
};
|
2012-10-24 10:31:02 +00:00
|
|
|
};
|
2010-01-05 15:32:14 +00:00
|
|
|
|
2018-09-02 06:13:24 +00: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 15:32:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|