rust-motd: added configuration for rust-motd service

This commit is contained in:
Tigor Hutasuhut 2024-06-20 15:48:18 +07:00
parent e9dc037124
commit 9007b42d93
4 changed files with 59 additions and 6 deletions

View file

@ -14,5 +14,6 @@ in
openvpn.enable = mkEnableOption "openvpn";
stubby.enable = mkEnableOption "stubby";
jellyfin.enable = mkEnableOption "jellyfin";
rust-motd.enable = mkEnableOption "rust-motd";
};
}

View file

@ -48,6 +48,7 @@
openvpn.enable = true;
stubby.enable = true;
jellyfin.enable = true;
rust-motd.enable = true;
};
};
}

View file

@ -4,12 +4,13 @@
./caddy.nix
./cockpit.nix
./forgejo.nix
./samba.nix
./nextcloud.nix
./syncthing.nix
./kavita.nix
./openvpn.nix
./stubby.nix
./jellyfin.nix
./kavita.nix
./nextcloud.nix
./openvpn.nix
./rust-motd.nix
./samba.nix
./stubby.nix
./syncthing.nix
];
}

View file

@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
let
cfg = config.profile.services.rust-motd;
inherit (lib) mkIf mkMerge;
in
{
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
fail2ban
];
programs.rust-motd = {
enable = true;
settings = {
banner = {
color = "white";
command = "${pkgs.fortune-kind}/bin/fortune-kind | ${pkgs.neo-cowsay}/bin/cowsay --random";
};
service_status = mkMerge [
{ }
(mkIf config.profile.podman.pihole.enable { Pihole = "podman-pihole"; })
(mkIf config.profile.podman.qbittorrent.enable { QBittorrent = "podman-qbittorrent"; })
(mkIf config.profile.services.forgejo.enable { Forgejo = "forgejo"; })
];
uptime = {
prefix = "Up";
};
filesystems = {
Root = "/";
NAS = "/nas";
};
memory = {
swap_pos = "beside";
};
last_login = {
${config.profile.user.name} = 1;
};
last_run = { };
};
order = [
"banner"
"last_login"
"uptime"
"memory"
"service_status"
"filesystems"
"last_run"
];
};
};
}