44 lines
1.1 KiB
Nix
44 lines
1.1 KiB
Nix
{
|
|
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}
|
|
'';
|
|
})
|
|
];
|
|
}
|