36 lines
1.1 KiB
Nix
36 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.jalr;
|
|
in
|
|
{
|
|
options.jalr = {
|
|
autologin = {
|
|
enable = pkgs.lib.mkEnableOption "Enable tty1 autologin";
|
|
username = pkgs.lib.mkOption {
|
|
type = lib.types.str;
|
|
description = "Username of user to be automatically logged in at tty1";
|
|
};
|
|
};
|
|
};
|
|
config = lib.mkIf cfg.autologin.enable {
|
|
systemd.services."autovt@tty1" = {
|
|
description = "Autologin at the TTY1";
|
|
after = [ "systemd-logind.service" ]; # without it user session not started and xorg can't be run from this tty
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
Restart = "always";
|
|
Type = "idle";
|
|
};
|
|
};
|
|
systemd.services."autovt@" = {
|
|
serviceConfig = lib.mkForce {
|
|
ExecStart = [
|
|
"" # override upstream default with an empty ExecStart
|
|
"@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login --autologin '${cfg.autologin.username}' --noclear %I $TERM"
|
|
];
|
|
restartIfChanged = false;
|
|
};
|
|
};
|
|
};
|
|
}
|