diff --git a/hosts/nixedo/modules/audiobookshelf.nix b/hosts/nixedo/modules/audiobookshelf.nix index 2a88a638..cd77ab28 100644 --- a/hosts/nixedo/modules/audiobookshelf.nix +++ b/hosts/nixedo/modules/audiobookshelf.nix @@ -15,6 +15,26 @@ in default = "audiobookshelf.${homelab.baseDomain}"; 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 { diff --git a/hosts/nixedo/modules/immich.nix b/hosts/nixedo/modules/immich.nix index f6e66b25..c43af72d 100644 --- a/hosts/nixedo/modules/immich.nix +++ b/hosts/nixedo/modules/immich.nix @@ -20,6 +20,26 @@ in default = "photos.${homelab.baseDomain}"; 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 { diff --git a/hosts/nixedo/modules/jellyfin.nix b/hosts/nixedo/modules/jellyfin.nix index 2f21da3e..2831d9e8 100644 --- a/hosts/nixedo/modules/jellyfin.nix +++ b/hosts/nixedo/modules/jellyfin.nix @@ -15,6 +15,26 @@ in default = "${service}.${homelab.baseDomain}"; 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 { diff --git a/hosts/nixedo/modules/paperless.nix b/hosts/nixedo/modules/paperless.nix index fd048246..2b5af7bc 100644 --- a/hosts/nixedo/modules/paperless.nix +++ b/hosts/nixedo/modules/paperless.nix @@ -15,6 +15,26 @@ in default = "${service}.${homelab.baseDomain}"; 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 { diff --git a/hosts/nixedo/services/homepage/default.nix b/hosts/nixedo/services/homepage/default.nix index 2b6a3a78..26d7c84e 100644 --- a/hosts/nixedo/services/homepage/default.nix +++ b/hosts/nixedo/services/homepage/default.nix @@ -35,7 +35,7 @@ in listenPort = cfg.port; openFirewall = true; - services = (import ./services.nix { inherit config; }); + services = (import ./services.nix { inherit config lib; }); widgets = import ./widgets.nix; }; diff --git a/hosts/nixedo/services/homepage/services.nix b/hosts/nixedo/services/homepage/services.nix index bd261c2a..196ac3a5 100644 --- a/hosts/nixedo/services/homepage/services.nix +++ b/hosts/nixedo/services/homepage/services.nix @@ -1,60 +1,32 @@ -{ config }: +{ config, lib }: -[ - { - "Media" = [ - { - "Jellyfin" = { - href = "https://jellyfin.oliverdavies.uk"; - icon = "jellyfin"; - description = "The Free Software Media System"; - siteMonitor = "http://localhost:8096"; - }; - } +with lib; - { - "Immich" = { - href = "https://photos.oliverdavies.uk"; - icon = "immich"; - description = "Self-hosted photo and video management solution"; - siteMonitor = "http://localhost:${toString config.services.immich.port}"; - }; - } +let + homelab = config.features.homelab.services; - { - "Audiobookshelf" = { - href = "https://audiobookshelf.oliverdavies.uk"; - icon = "audiobookshelf"; - description = "Self-hosted audiobook and podcast server"; - siteMonitor = "http://localhost:4001"; - }; - } - ]; - } + homepageCategories = [ + "Media" + "Services" + ]; - { - "Services" = [ - { - "Uptime Kuma" = { - description = "A fancy self-hosted monitoring tool"; - href = "https://uptime.oliverdavies.uk"; - icon = "uptime-kuma"; - siteMonitor = "http://localhost:${toString config.services.uptime-kuma.settings.PORT}"; - }; - } + homepageServices = + category: + (attrsets.filterAttrs ( + name: value: value ? homepage && value.homepage.category == category + ) homelab); - { - "Paperless-ngx" = - let - cfg = config.services.paperless; - in - { - description = "Document management system"; - href = cfg.settings.PAPERLESS_URL; - icon = "paperless"; - siteMonitor = "http://localhost:${toString cfg.port}"; + services = lists.forEach homepageCategories (cat: { + "${cat}" = + lib.lists.forEach (lib.attrsets.mapAttrsToList (name: value: name) (homepageServices "${cat}")) + (x: { + "${homelab.${x}.homepage.name}" = { + icon = homelab.${x}.homepage.icon; + description = homelab.${x}.homepage.description; + href = "https://${homelab.${x}.url}"; + siteMonitor = "https://${homelab.${x}.url}"; }; - } - ]; - } -] + }); + }); +in +services diff --git a/hosts/nixedo/services/uptime-kuma.nix b/hosts/nixedo/services/uptime-kuma.nix index 01f7fe1a..ac761d12 100644 --- a/hosts/nixedo/services/uptime-kuma.nix +++ b/hosts/nixedo/services/uptime-kuma.nix @@ -15,6 +15,26 @@ in default = "uptime.${homelab.baseDomain}"; 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 {