From 6c2a43abc9894c213aee8934483e421bf80c3212 Mon Sep 17 00:00:00 2001 From: Sergei Bulavintsev Date: Mon, 25 Nov 2024 15:12:12 +0300 Subject: [PATCH] feat(nix): add parametrized homepage widgets --- .../nixos/containers/homepage/default.nix | 67 ++++++++++++------- .../nz/hardware-configuration.nix | 2 +- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/nix/modules/nixos/containers/homepage/default.nix b/nix/modules/nixos/containers/homepage/default.nix index 9e0aea6..7a28612 100644 --- a/nix/modules/nixos/containers/homepage/default.nix +++ b/nix/modules/nixos/containers/homepage/default.nix @@ -46,11 +46,14 @@ in { "traefik.sbulav.ru" "adguard.sbulav.ru" "flood.sbulav.ru" + "jellyfin2.sbulav.ru" ]; }; services.homepage-dashboard = { enable = true; + # TODO: Pass secrets via services.homepage-dashboard.environmentFile + # https://gethomepage.dev/installation/docker/#using-environment-secrets widgets = [ { resources = { @@ -61,50 +64,68 @@ in { } ]; services = [ - { - "My First Group" = [ - { - "My First Service" = { - description = "Homepage is awesome"; - href = "http://localhost/"; - }; - } - ]; - } { "Network" = [ - { - "My Second Service" = { - description = "Homepage is the best"; - href = "http://localhost/"; - }; - } # TODO: implement enabling widgets based on config - { "Traefik" = { icon = "traefik"; - href = "https://traefik.sbulav.ru"; + href = "https://traefik.${config.${namespace}.containers.traefik.domain}"; widget = { type = "traefik"; - url = "https://traefik.sbulav.ru"; + url = "https://traefik.${config.${namespace}.containers.traefik.domain}"; }; }; } { - "Adguard" = { + "Adguard" = mkIf config.${namespace}.containers.adguard.enable { icon = "adguard-home"; - href = "https://adguard.sbulav.ru"; + href = "https://${config.${namespace}.containers.adguard.host}"; widget = { type = "adguard"; url = "http://${config.${namespace}.containers.adguard.localAddress}:3000"; }; }; } + ]; + } + { + "Media" = [ + { + "nextcloud" = mkIf config.${namespace}.containers.nextcloud.enable { + icon = "nextcloud"; + href = "https://${config.${namespace}.containers.nextcloud.host}"; + widget = { + type = "nextcloud"; + url = "https://${config.${namespace}.containers.nextcloud.host}"; + }; + }; + } + + { + "jellyfin" = { + icon = "jellyfin"; + href = "https://${config.${namespace}.containers.jellyfin.host}"; + widget = { + type = "jellyfin"; + key = "apikey"; + url = "http://${config.${namespace}.containers.jellyfin.localAddress}:8196"; + enableBlocks = true; # optional, defaults to false + enableNowPlaying = true; # optional, defaults to true + enableUser = true; # optional, defaults to false + showEpisodeNumber = true; # optional, defaults to false + expandOneStreamToTwoRows = false; # optional, defaults to true + }; + }; + } + ]; + } + { + "ARR Stack" = [ { - "Flood" = { + "Flood" = mkIf config.${namespace}.containers.flood.enable { icon = "flood"; - href = "https://flood.sbulav.ru"; + href = "https://${config.${namespace}.containers.flood.host}"; widget = { type = "flood"; url = "http://${config.${namespace}.containers.flood.localAddress}:3000"; diff --git a/nix/systems/x86_64-linux/nz/hardware-configuration.nix b/nix/systems/x86_64-linux/nz/hardware-configuration.nix index 2817d45..8c43840 100644 --- a/nix/systems/x86_64-linux/nz/hardware-configuration.nix +++ b/nix/systems/x86_64-linux/nz/hardware-configuration.nix @@ -66,7 +66,7 @@ "100.87.128.100" = ["vault-c7.pyn.ru"]; "100.91.128.100" = ["vault-c11.pyn.ru"]; "100.92.128.100" = ["vault-c12.pyn.ru"]; - "192.168.89.206" = ["serverz" "jellyfin2.sbulav.ru" "authelia.sbulav.ru"]; + "192.168.89.206" = ["serverz" "jellyfin2.sbulav.ru" "authelia.sbulav.ru" "homepage.sbulav.ru"]; }; networking.interfaces.wlp3s0.ipv4.routes = [ {