summary refs log tree commit diff
path: root/nixos/modules/services/ttys
diff options
context:
space:
mode:
authorArseniy Seroka <jagajaga@users.noreply.github.com>2016-01-09 20:52:08 +0300
committerArseniy Seroka <jagajaga@users.noreply.github.com>2016-01-09 20:52:08 +0300
commitc03fe792656b506b40e18d9c070d0bad8f7f1c3e (patch)
treefa3b8e6d5bf875f30a5629f72d76a87e0d67944a /nixos/modules/services/ttys
parent84631f32276a86a1748effc7399c8c0ea97500ba (diff)
parent119c8f91e7f17d2cb95f42985816820600c389cf (diff)
downloadnixlib-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar
nixlib-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.gz
nixlib-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.bz2
nixlib-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.lz
nixlib-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.xz
nixlib-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.tar.zst
nixlib-c03fe792656b506b40e18d9c070d0bad8f7f1c3e.zip
Merge pull request #10996 from oxij/nixos-label
nixos: introduce system.nixosLabel support
Diffstat (limited to 'nixos/modules/services/ttys')
-rw-r--r--nixos/modules/services/ttys/agetty.nix20
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