diff options
Diffstat (limited to 'services/uptimekuma.nix')
| -rw-r--r-- | services/uptimekuma.nix | 84 |
1 files changed, 41 insertions, 43 deletions
diff --git a/services/uptimekuma.nix b/services/uptimekuma.nix index 4cdd5f2..1ac6006 100644 --- a/services/uptimekuma.nix +++ b/services/uptimekuma.nix @@ -1,78 +1,76 @@ -{config, lib, pkgs, ...}: +{ config, lib, ... }: let - cfg = config.wilkuu.services.uptimekuma; - hostname = config.networking.hostName; -in + cfg = config.wilkuu.services.uptimekuma; + hostname = config.networking.hostName; +in { options.wilkuu.services.uptimekuma = with lib; { domain = mkOption { - type = types.str; - default = "uptime.${hostname}.local"; - example = "uptime.wilkuu.xyz"; - description = "Domain for http connections."; - }; + type = types.str; + default = "uptime.${hostname}.local"; + example = "uptime.wilkuu.xyz"; + description = "Domain for http connections."; + }; doACME = mkEnableOption "Enable ACME for uptime kuma here"; - enable = mkEnableOption "Enable the uptime-kuma service"; - dataDir = mkOption { - type = types.path; - description = "Storage localtion for uptime kuma data, currently ignored, because nixpkgs sucks"; - default = "/srv/data/uptimekuma"; - example = "/srv/data/uptimekuma"; - }; + enable = mkEnableOption "Enable the uptime-kuma service"; + dataDir = mkOption { + type = types.path; + description = "Storage localtion for uptime kuma data, currently ignored, because nixpkgs sucks"; + default = "/srv/data/uptimekuma"; + example = "/srv/data/uptimekuma"; + }; }; - config = lib.mkIf cfg.enable (let - # sopsPath = ../secrets/${hostname}/vaultwarden.yaml; - # secrets = []; - # toSops = (sname: "uptime-kuma/${sname}"); - in { - networking.hosts = { - "127.0.0.1" = [cfg.domain]; - }; + config = lib.mkIf cfg.enable ({ + networking.hosts = { + "127.0.0.1" = [ cfg.domain ]; + }; users.users.uptimekuma = { isSystemUser = true; group = "uptimekuma"; }; - users.groups.uptimekuma = {}; + users.groups.uptimekuma = { }; systemd.services.uptime-kuma.serviceConfig.User = "uptimekuma"; - # sops.secrets = - # (lib.genAttrs (map toSops secrets) + # sops.secrets = + # (lib.genAttrs (map toSops secrets) # (name: { - # sopsFile = sopsPath; - # mode = "0440"; - # owner = "uptime-kuma"; - # })); + # sopsFile = sopsPath; + # mode = "0440"; + # owner = "uptime-kuma"; + # })); services.nginx.virtualHosts."${cfg.domain}" = { - addSSL = cfg.doACME; + addSSL = cfg.doACME; enableACME = cfg.doACME; locations."/" = { - proxyPass = "http://localhost:3111"; + proxyPass = "http://localhost:3111"; recommendedProxySettings = true; }; }; - wilkuu.services.mysql = let - user = config.systemd.services.uptime-kuma.serviceConfig.User; - in { - unix_users = [user]; - databases.uptimekuma = { - enable = true; - allowedUsers = [user]; + wilkuu.services.mysql = + let + user = config.systemd.services.uptime-kuma.serviceConfig.User; + in + { + unix_users = [ user ]; + databases.uptimekuma = { + enable = true; + allowedUsers = [ user ]; + }; }; - }; services.uptime-kuma = { enable = true; settings = { UPTIME_KUMA_PORT = "3111"; - UPTIME_KUMA_HOST="127.0.0.1"; + UPTIME_KUMA_HOST = "127.0.0.1"; UPTIME_KUMA_DB_TYPE = "sqlite"; UPTIME_KUMA_DB_SOCKET = "/var/lib/mysql/mysql.sock"; }; }; - }); + }); } |
