Refactor homelab modules
This commit is contained in:
parent
e6f269b123
commit
fe508bd127
9 changed files with 224 additions and 83 deletions
|
@ -1,16 +1,34 @@
|
|||
{ config, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = homelab.services.${service};
|
||||
homelab = config.nixosModules.homelab;
|
||||
service = "uptime-kuma";
|
||||
in
|
||||
{
|
||||
services = {
|
||||
uptime-kuma.enable = true;
|
||||
options.nixosModules.homelab.services.${service} = {
|
||||
enable = mkEnableOption "Enable ${service}";
|
||||
|
||||
nginx.virtualHosts."uptime.oliverdavies.uk" = {
|
||||
forceSSL = true;
|
||||
useACMEHost = "oliverdavies.uk";
|
||||
url = mkOption {
|
||||
default = "uptime.${homelab.baseDomain}";
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString config.services.uptime-kuma.settings.PORT}";
|
||||
recommendedProxySettings = true;
|
||||
config = mkIf cfg.enable {
|
||||
services = {
|
||||
${service}.enable = true;
|
||||
|
||||
nginx.virtualHosts.${cfg.url} = {
|
||||
forceSSL = true;
|
||||
useACMEHost = homelab.baseDomain;
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString config.services.${service}.settings.PORT}";
|
||||
recommendedProxySettings = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue