Move Homepage configuration into service

Move each service's Homepage Dashboard configuration into its own
module.

Based on
8928785060/homelab/services/homepage/default.nix.

See https://www.youtube.com/watch?v=f-x5cB6qCzA&t=1435s (What's on my
Home Server 2025 – NixOS Edition).
This commit is contained in:
Oliver Davies 2025-04-30 11:58:59 +01:00
parent bdf226d5f7
commit a9cf2109a6
7 changed files with 127 additions and 55 deletions

View file

@ -15,6 +15,26 @@ in
default = "audiobookshelf.${homelab.baseDomain}"; default = "audiobookshelf.${homelab.baseDomain}";
type = types.str; type = types.str;
}; };
homepage.name = mkOption {
default = "Audiobookshelf";
type = types.str;
};
homepage.description = mkOption {
default = "Self-hosted audiobook and podcast server";
type = types.str;
};
homepage.icon = mkOption {
default = "audiobookshelf";
type = types.str;
};
homepage.category = mkOption {
default = "Media";
type = types.str;
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -20,6 +20,26 @@ in
default = "photos.${homelab.baseDomain}"; default = "photos.${homelab.baseDomain}";
type = types.str; type = types.str;
}; };
homepage.name = mkOption {
default = "Immich";
type = types.str;
};
homepage.description = mkOption {
default = "Self-hosted photo and video management solution";
type = types.str;
};
homepage.icon = mkOption {
default = "immich";
type = types.str;
};
homepage.category = mkOption {
default = "Media";
type = types.str;
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -15,6 +15,26 @@ in
default = "${service}.${homelab.baseDomain}"; default = "${service}.${homelab.baseDomain}";
type = types.str; type = types.str;
}; };
homepage.name = mkOption {
default = "Jellyfin";
type = types.str;
};
homepage.description = mkOption {
default = "The Free Software Media System";
type = types.str;
};
homepage.icon = mkOption {
default = "jellyfin";
type = types.str;
};
homepage.category = mkOption {
default = "Media";
type = types.str;
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -15,6 +15,26 @@ in
default = "${service}.${homelab.baseDomain}"; default = "${service}.${homelab.baseDomain}";
type = types.str; type = types.str;
}; };
homepage.name = mkOption {
default = "Paperless-ngx";
type = types.str;
};
homepage.description = mkOption {
default = "Document management system";
type = types.str;
};
homepage.icon = mkOption {
default = "paperless";
type = types.str;
};
homepage.category = mkOption {
default = "Services";
type = types.str;
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -35,7 +35,7 @@ in
listenPort = cfg.port; listenPort = cfg.port;
openFirewall = true; openFirewall = true;
services = (import ./services.nix { inherit config; }); services = (import ./services.nix { inherit config lib; });
widgets = import ./widgets.nix; widgets = import ./widgets.nix;
}; };

View file

@ -1,60 +1,32 @@
{ config }: { config, lib }:
[ with lib;
{
"Media" = [
{
"Jellyfin" = {
href = "https://jellyfin.oliverdavies.uk";
icon = "jellyfin";
description = "The Free Software Media System";
siteMonitor = "http://localhost:8096";
};
}
{ let
"Immich" = { homelab = config.features.homelab.services;
href = "https://photos.oliverdavies.uk";
icon = "immich";
description = "Self-hosted photo and video management solution";
siteMonitor = "http://localhost:${toString config.services.immich.port}";
};
}
{ homepageCategories = [
"Audiobookshelf" = { "Media"
href = "https://audiobookshelf.oliverdavies.uk"; "Services"
icon = "audiobookshelf";
description = "Self-hosted audiobook and podcast server";
siteMonitor = "http://localhost:4001";
};
}
]; ];
}
{ homepageServices =
"Services" = [ category:
{ (attrsets.filterAttrs (
"Uptime Kuma" = { name: value: value ? homepage && value.homepage.category == category
description = "A fancy self-hosted monitoring tool"; ) homelab);
href = "https://uptime.oliverdavies.uk";
icon = "uptime-kuma";
siteMonitor = "http://localhost:${toString config.services.uptime-kuma.settings.PORT}";
};
}
{ services = lists.forEach homepageCategories (cat: {
"Paperless-ngx" = "${cat}" =
let lib.lists.forEach (lib.attrsets.mapAttrsToList (name: value: name) (homepageServices "${cat}"))
cfg = config.services.paperless; (x: {
in "${homelab.${x}.homepage.name}" = {
{ icon = homelab.${x}.homepage.icon;
description = "Document management system"; description = homelab.${x}.homepage.description;
href = cfg.settings.PAPERLESS_URL; href = "https://${homelab.${x}.url}";
icon = "paperless"; siteMonitor = "https://${homelab.${x}.url}";
siteMonitor = "http://localhost:${toString cfg.port}";
}; };
} });
]; });
} in
] services

View file

@ -15,6 +15,26 @@ in
default = "uptime.${homelab.baseDomain}"; default = "uptime.${homelab.baseDomain}";
type = types.str; type = types.str;
}; };
homepage.name = mkOption {
default = "Uptime Kuma";
type = types.str;
};
homepage.description = mkOption {
default = "A fancy self-hosted monitoring tool";
type = types.str;
};
homepage.icon = mkOption {
default = "uptime-kuma";
type = types.str;
};
homepage.category = mkOption {
default = "Services";
type = types.str;
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {