diff options
author | Arseniy Seroka <jagajaga@users.noreply.github.com> | 2016-01-09 20:52:08 +0300 |
---|---|---|
committer | Arseniy Seroka <jagajaga@users.noreply.github.com> | 2016-01-09 20:52:08 +0300 |
commit | c03fe792656b506b40e18d9c070d0bad8f7f1c3e (patch) | |
tree | fa3b8e6d5bf875f30a5629f72d76a87e0d67944a /nixos/modules/services | |
parent | 84631f32276a86a1748effc7399c8c0ea97500ba (diff) | |
parent | 119c8f91e7f17d2cb95f42985816820600c389cf (diff) | |
download | nixpkgs-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar nixpkgs-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.gz nixpkgs-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.bz2 nixpkgs-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.lz nixpkgs-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.xz nixpkgs-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.zst nixpkgs-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.zip |
Merge pull request #10996 from oxij/nixos-label
nixos: introduce system.nixosLabel support
Diffstat (limited to 'nixos/modules/services')
-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 85ee23c1a3d..ea7196fc873 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 |