diff --git a/machines/oracle/configuration.nix b/machines/oracle/configuration.nix index dd53d42..bbbc45e 100644 --- a/machines/oracle/configuration.nix +++ b/machines/oracle/configuration.nix @@ -104,6 +104,7 @@ networking.firewall.allowedTCPPorts = [80 443]; my.server.proxyIP = "10.0.0.2"; + my.services.homepage-dashboard.proxy = true; my.services.forgejo.proxy = true; services.uptime-kuma = { diff --git a/machines/thinkcentre/configuration.nix b/machines/thinkcentre/configuration.nix index 9e99e58..ff59423 100644 --- a/machines/thinkcentre/configuration.nix +++ b/machines/thinkcentre/configuration.nix @@ -69,6 +69,11 @@ }; }; + my.services.homepage-dashboard = { + enable = true; + port = 8082; + }; + age.secrets.keycloakDb.file = ../../secrets/keycloak-db.age; services.keycloak = { enable = true; diff --git a/modules/services/default.nix b/modules/services/default.nix index c7f3bff..f82c953 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -1,5 +1,6 @@ { imports = [ ./forgejo + ./homepage-dashboard ]; } diff --git a/modules/services/forgejo/default.nix b/modules/services/forgejo/default.nix index fdda099..39cccb4 100644 --- a/modules/services/forgejo/default.nix +++ b/modules/services/forgejo/default.nix @@ -52,16 +52,16 @@ in { networking.firewall.interfaces."${firewallInterface}".allowedTCPPorts = [cfg.port]; - # services.homepage-dashboard.services = [ - # { - # Git = { - # Forgejo = { - # href = url; - # description = "Beyond coding. We forge."; - # }; - # }; - # } - # ]; + services.homepage-dashboard.services = [ + { + Git = { + Forgejo = { + href = url; + description = "Beyond coding. We forge."; + }; + }; + } + ]; }) (mkIf cfg.proxy { services.caddy.virtualHosts."${url}".extraConfig = '' diff --git a/modules/services/homepage-dashboard/default.nix b/modules/services/homepage-dashboard/default.nix new file mode 100644 index 0000000..f8bd405 --- /dev/null +++ b/modules/services/homepage-dashboard/default.nix @@ -0,0 +1,43 @@ +{ + inputs, + lib, + config, + ... +}: +with lib; let + cfg = config.my.services.homepage-dashboard; + inherit (config.my.server) domain proxyIP firewallInterface; +in { + disabledModules = ["services/misc/homepage-dashboard.nix"]; + + imports = [ + # Use homepage-dashboard service from nixos-unstable channel. + "${inputs.unstable}/nixos/modules/services/misc/homepage-dashboard.nix" + ]; + + options.my.services.homepage-dashboard = { + enable = mkEnableOption "Homepage Dashboard"; + proxy = mkEnableOption "Homepage Dashboard reverse proxy entry"; + port = mkOption { + type = types.port; + default = 8082; + description = "HTTP port for the homepage-dashboard service."; + }; + }; + + config = mkMerge [ + (mkIf cfg.enable { + services.homepage-dashboard = { + enable = true; + listenPort = cfg.port; + }; + + networking.firewall.interfaces."${firewallInterface}".allowedTCPPorts = [cfg.port]; + }) + (mkIf cfg.proxy { + services.caddy.virtualHosts."${domain}".extraConfig = '' + reverse_proxy http://${proxyIP}:${toString cfg.port} + ''; + }) + ]; +}