Files
dendritic/modules/nixos/login-text.nix
T
2026-04-04 13:15:29 -05:00

58 lines
1.3 KiB
Nix

{ inputs, ... }: {
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.";
};
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";
};
last_login = {
john = 3;
root = 3;
};
service_status = lib.mkMerge [
defaultServiceStatus
config.loginText.extraServiceStatus
];
# This calculation is wrong for LXCs
# uptime = {
# prefix = "Uptime";
# };
memory = {
swap_pos = "beside";
};
filesystems = {
root = "/";
};
};
};
};
};
}