1 { config, lib, pkgs, ... }:
6 cfg = config.services.getty;
9 "--login-program" "${cfg.loginProgram}"
10 ] ++ optionals (cfg.autologinUser != null) [
11 "--autologin" cfg.autologinUser
12 ] ++ optionals (cfg.loginOptions != null) [
13 "--login-options" cfg.loginOptions
17 "@${pkgs.util-linux}/sbin/agetty agetty ${escapeShellArgs baseArgs} ${args}";
26 (mkRenamedOptionModule [ "services" "mingetty" ] [ "services" "getty" ])
27 (mkRemovedOptionModule [ "services" "getty" "serialSpeed" ] ''set non-standard baudrates with `boot.kernelParams` i.e. boot.kernelParams = ["console=ttyS2,1500000"];'')
34 autologinUser = mkOption {
35 type = types.nullOr types.str;
38 Username of the account that will be automatically logged in at the console.
39 If unspecified, a login prompt is shown as usual.
43 loginProgram = mkOption {
45 default = "${pkgs.shadow}/bin/login";
46 defaultText = literalExpression ''"''${pkgs.shadow}/bin/login"'';
48 Path to the login binary executed by agetty.
52 loginOptions = mkOption {
53 type = types.nullOr types.str;
56 Template for arguments to be passed to
59 See {manpage}`agetty(1)` for details,
60 including security considerations. If unspecified, agetty
61 will not be invoked with a {option}`--login-options`
64 example = "-h darkstar -- \\u";
67 extraArgs = mkOption {
68 type = types.listOf types.str;
71 Additional arguments passed to agetty.
73 example = [ "--nohostname" ];
76 greetingLine = mkOption {
79 Welcome line printed by agetty.
80 The default shows current NixOS version label, machine type and tty.
88 Help line printed by agetty below the welcome line.
89 Used by the installation CD to give some hints on
102 # Note: this is set here rather than up there so that changing
103 # nixos.label would not rebuild manual pages
104 services.getty.greetingLine = mkDefault ''<<< Welcome to ${config.system.nixos.distroName} ${config.system.nixos.label} (\m) - \l >>>'';
105 services.getty.helpLine = mkIf (config.documentation.nixos.enable && config.documentation.doc.enable) "\nRun 'nixos-help' for the NixOS manual.";
107 systemd.services."getty@" =
108 { serviceConfig.ExecStart = [
109 "" # override upstream default with an empty ExecStart
110 (gettyCmd "--noclear --keep-baud %I 115200,38400,9600 $TERM")
112 restartIfChanged = false;
115 systemd.services."serial-getty@" =
116 { serviceConfig.ExecStart = [
117 "" # override upstream default with an empty ExecStart
118 (gettyCmd "%I --keep-baud $TERM")
120 restartIfChanged = false;
123 systemd.services."autovt@" =
124 { serviceConfig.ExecStart = [
125 "" # override upstream default with an empty ExecStart
126 (gettyCmd "--noclear %I $TERM")
128 restartIfChanged = false;
131 systemd.services."container-getty@" =
132 { serviceConfig.ExecStart = [
133 "" # override upstream default with an empty ExecStart
134 (gettyCmd "--noclear --keep-baud pts/%I 115200,38400,9600 $TERM")
136 restartIfChanged = false;
139 systemd.services.console-getty =
140 { serviceConfig.ExecStart = [
141 "" # override upstream default with an empty ExecStart
142 (gettyCmd "--noclear --keep-baud console 115200,38400,9600 $TERM")
144 serviceConfig.Restart = "always";
145 restartIfChanged = false;
146 enable = mkDefault config.boot.isContainer;
149 environment.etc.issue = mkDefault
150 { # Friendly greeting on the virtual consoles.
151 source = pkgs.writeText "issue" ''
153 \e[1;32m${config.services.getty.greetingLine}
\e[0m
154 ${config.services.getty.helpLine}
161 meta.maintainers = with maintainers; [ RossComputerGuy ];