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