service_status motd updates

This commit is contained in:
John Lancaster
2026-04-04 13:15:29 -05:00
parent bccb96a0b3
commit 84b32cea01
2 changed files with 54 additions and 35 deletions
+47 -35
View File
@@ -1,44 +1,56 @@
{ inputs, ... }: {
flake.modules.nixos.login-text = { config, ... }: {
programs.rust-motd = {
enable = true;
refreshInterval = "*:0/5";
order = [
"global"
"last_login"
"service_status"
# "uptime"
"memory"
"filesystems"
];
settings = {
global = {
time_format = "%Y-%m-%d %H:%M:%S %Z";
};
flake.modules.nixos.login-text = { config, lib, ... }:
let
defaultServiceStatus = {
SSH = "sshd.socket";
"SSH Cert Renewal" = "step-ssh-host-renew.timer";
};
in {
options.loginText.extraServiceStatus = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
description = "Additional rust-motd service status entries keyed by display name.";
};
last_login = {
john = 3;
root = 3;
};
config = {
programs.rust-motd = {
enable = true;
refreshInterval = "*:0/5";
order = [
"global"
"last_login"
"service_status"
# "uptime"
"memory"
"filesystems"
];
settings = {
global = {
time_format = "%Y-%m-%d %H:%M:%S %Z";
};
service_status = {
Docker = "docker";
SSH = "sshd.socket";
"SSH Cert Renewal" = "step-ssh-host-renew.timer";
"mTLS Renewal" = "mtls-renew.timer";
};
last_login = {
john = 3;
root = 3;
};
# This calculation is wrong for LXCs
# uptime = {
# prefix = "Uptime";
# };
service_status = lib.mkMerge [
defaultServiceStatus
config.loginText.extraServiceStatus
];
memory = {
swap_pos = "beside";
};
# This calculation is wrong for LXCs
# uptime = {
# prefix = "Uptime";
# };
filesystems = {
root = "/";
memory = {
swap_pos = "beside";
};
filesystems = {
root = "/";
};
};
};
};