diff options
Diffstat (limited to 'nixos/modules/services/ttys/agetty.nix')
-rw-r--r-- | nixos/modules/services/ttys/agetty.nix | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/nixos/modules/services/ttys/agetty.nix b/nixos/modules/services/ttys/agetty.nix index 85ee23c1a3dd..ea7196fc8733 100644 --- a/nixos/modules/services/ttys/agetty.nix +++ b/nixos/modules/services/ttys/agetty.nix @@ -2,6 +2,13 @@ with lib; +let + + autologinArg = optionalString (config.services.mingetty.autologinUser != null) "--autologin ${config.services.mingetty.autologinUser}"; + gettyCmd = extraArgs: "@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login ${autologinArg} ${extraArgs}"; + +in + { ###### interface @@ -21,9 +28,9 @@ with lib; greetingLine = mkOption { type = types.str; - default = ''<<< Welcome to NixOS ${config.system.nixosVersion} (\m) - \l >>>''; description = '' Welcome line printed by mingetty. + The default shows current NixOS version label, machine type and tty. ''; }; @@ -55,10 +62,11 @@ with lib; ###### implementation - config = let - autologinArg = optionalString (config.services.mingetty.autologinUser != null) "--autologin ${config.services.mingetty.autologinUser}"; - gettyCmd = extraArgs: "@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login ${autologinArg} ${extraArgs}"; - in { + config = { + # Note: this is set here rather than up there so that changing + # nixosLabel would not rebuild manual pages + services.mingetty.greetingLine = mkDefault ''<<< Welcome to NixOS ${config.system.nixosLabel} (\m) - \l >>>''; + systemd.services."getty@" = { serviceConfig.ExecStart = gettyCmd "--noclear --keep-baud %I 115200,38400,9600 $TERM"; restartIfChanged = false; @@ -81,7 +89,7 @@ with lib; { serviceConfig.ExecStart = gettyCmd "--noclear --keep-baud console 115200,38400,9600 $TERM"; serviceConfig.Restart = "always"; restartIfChanged = false; - enable = mkDefault config.boot.isContainer; + enable = mkDefault config.boot.isContainer; }; environment.etc = singleton |