From 302fcc4674803169af9efdb247fd529e65853459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Fri, 26 Feb 2021 13:17:04 +0100 Subject: [PATCH] nixos/getty: add services.getty.extraArgs --- nixos/modules/services/ttys/getty.nix | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/ttys/getty.nix b/nixos/modules/services/ttys/getty.nix index ecfabef5fb13..2480e681de8d 100644 --- a/nixos/modules/services/ttys/getty.nix +++ b/nixos/modules/services/ttys/getty.nix @@ -5,17 +5,16 @@ with lib; let cfg = config.services.getty; - loginArgs = [ + baseArgs = [ "--login-program" "${pkgs.shadow}/bin/login" ] ++ optionals (cfg.autologinUser != null) [ "--autologin" cfg.autologinUser ] ++ optionals (cfg.loginOptions != null) [ "--login-options" cfg.loginOptions - ]; + ] ++ cfg.extraArgs; - gettyCmd = extraArgs: - "@${pkgs.util-linux}/sbin/agetty agetty ${escapeShellArgs loginArgs} " - + extraArgs; + gettyCmd = args: + "@${pkgs.util-linux}/sbin/agetty agetty ${escapeShellArgs baseArgs} ${args}"; in @@ -54,7 +53,16 @@ in will not be invoked with a option. ''; - example = "-h darkstar -- \u"; + example = "-h darkstar -- \\u"; + }; + + extraArgs = mkOption { + type = types.listOf types.str; + default = [ ]; + description = '' + Additional arguments passed to agetty. + ''; + example = [ "--nohostname" ]; }; greetingLine = mkOption {