feat(homepage-dashboard): adding some disk info

This commit is contained in:
2025-09-26 17:41:19 +02:00
parent 551a47989c
commit e721a2088b

View File

@@ -2,17 +2,19 @@
config, config,
lib, lib,
... ...
}: let }:
let
unit = "homepage-dashboard"; unit = "homepage-dashboard";
cfg = config.server.homepage-dashboard; cfg = config.server.homepage-dashboard;
srv = config.server; srv = config.server;
in { in
{
options.server.homepage-dashboard = { options.server.homepage-dashboard = {
enable = lib.mkEnableOption { enable = lib.mkEnableOption {
description = "Enable ${unit}"; description = "Enable ${unit}";
}; };
misc = lib.mkOption { misc = lib.mkOption {
default = []; default = [ ];
type = lib.types.listOf ( type = lib.types.listOf (
lib.types.attrsOf ( lib.types.attrsOf (
lib.types.submodule { lib.types.submodule {
@@ -103,118 +105,128 @@ in {
} }
{ {
resources = { resources = {
label = ""; label = "root";
memory = true; memory = true;
disk = ["/"]; disk = [ "/dev/dm-1" ];
};
}
{
resources = {
label = "zfs";
memory = true;
disk = [ "/mnt/data" ];
}; };
} }
]; ];
services =
services = let let
homepageCategories = [ homepageCategories = [
"Arr" "Arr"
"Media" "Media"
"Downloads" "Downloads"
"Services" "Services"
"Smart Home" "Smart Home"
]; ];
hl = config.server; hl = config.server;
mergedServices = hl // hl.podman; mergedServices = hl // hl.podman;
homepageServices = x: (lib.attrsets.filterAttrs ( homepageServices =
name: value: value ? homepage && value.homepage.category == x x:
) (lib.attrsets.filterAttrs (
mergedServices); name: value: value ? homepage && value.homepage.category == x
in ) mergedServices);
in
lib.lists.forEach homepageCategories (cat: { lib.lists.forEach homepageCategories (cat: {
"${cat}" = "${cat}" =
lib.lists.forEach lib.lists.forEach
(lib.attrsets.mapAttrsToList (name: value: { (lib.attrsets.mapAttrsToList (name: value: {
inherit name; inherit name;
url = value.url; url = value.url;
homepage = value.homepage; homepage = value.homepage;
}) (homepageServices "${cat}")) }) (homepageServices "${cat}"))
(x: { (x: {
"${x.homepage.name}" = { "${x.homepage.name}" = {
icon = x.homepage.icon; icon = x.homepage.icon;
description = x.homepage.description; description = x.homepage.description;
href = "https://${x.url}${x.homepage.path or ""}"; href = "https://${x.url}${x.homepage.path or ""}";
siteMonitor = "https://${x.url}${x.homepage.path or ""}"; siteMonitor = "https://${x.url}${x.homepage.path or ""}";
}; };
}); });
}) })
++ [{Misc = cfg.misc;}] ++ [ { Misc = cfg.misc; } ]
++ [ ++ [
{ {
Glances = let Glances =
port = toString config.services.glances.port; let
in [ port = toString config.services.glances.port;
{ in
Info = { [
widget = { {
type = "glances"; Info = {
url = "http://localhost:${port}"; widget = {
metric = "info"; type = "glances";
chart = false; url = "http://localhost:${port}";
version = 4; metric = "info";
chart = false;
version = 4;
};
}; };
}; }
} {
{ "CPU Temp" = {
"CPU Temp" = { widget = {
widget = { type = "glances";
type = "glances"; url = "http://localhost:${port}";
url = "http://localhost:${port}"; metric = "sensor:Tctl";
metric = "sensor:Tctl"; chart = false;
chart = false; version = 4;
version = 4; };
}; };
}; }
} {
{ "GPU Radeon" = {
"GPU Radeon" = { widget = {
widget = { type = "glances";
type = "glances"; url = "http://localhost:${port}";
url = "http://localhost:${port}"; metric = "sensor:junction";
metric = "sensor:junction"; chart = false;
chart = false; version = 4;
version = 4; };
}; };
}; }
} {
{ "GPU Intel" = {
"GPU Intel" = { widget = {
widget = { type = "glances";
type = "glances"; url = "http://localhost:${port}";
url = "http://localhost:${port}"; metric = "sensor:pkg";
metric = "sensor:pkg"; chart = false;
chart = false; version = 4;
version = 4; };
}; };
}; }
} {
{ Processes = {
Processes = { widget = {
widget = { type = "glances";
type = "glances"; url = "http://localhost:${port}";
url = "http://localhost:${port}"; metric = "process";
metric = "process"; chart = false;
chart = false; version = 4;
version = 4; };
}; };
}; }
} {
{ Network = {
Network = { widget = {
widget = { type = "glances";
type = "glances"; url = "http://localhost:${port}";
url = "http://localhost:${port}"; metric = "network:enp6s0";
metric = "network:enp6s0"; chart = false;
chart = false; version = 4;
version = 4; };
}; };
}; }
} ];
];
} }
]; ];
}; };
@@ -222,10 +234,12 @@ in {
traefik = { traefik = {
dynamicConfigOptions = { dynamicConfigOptions = {
http = { http = {
services.homepage.loadBalancer.servers = [{url = "http://127.0.0.1:${toString config.services.${unit}.listenPort}";}]; services.homepage.loadBalancer.servers = [
{ url = "http://127.0.0.1:${toString config.services.${unit}.listenPort}"; }
];
routers = { routers = {
homepage = { homepage = {
entryPoints = ["websecure"]; entryPoints = [ "websecure" ];
rule = "Host(`cnix.dev`)"; rule = "Host(`cnix.dev`)";
service = "homepage"; service = "homepage";
tls.certResolver = "letsencrypt"; tls.certResolver = "letsencrypt";