1 { config, pkgs, lib, ... }:
6 cfg = config.services.uptime-kuma;
11 services.uptime-kuma = {
12 enable = mkEnableOption (mdDoc "Uptime Kuma, this assumes a reverse proxy to be set.");
16 example = literalExpression "pkgs.uptime-kuma";
17 default = pkgs.uptime-kuma;
18 defaultText = "pkgs.uptime-kuma";
19 description = lib.mdDoc "Uptime Kuma package to use.";
22 settings = lib.mkOption {
24 lib.types.submodule { freeformType = with lib.types; attrsOf str; };
28 NODE_EXTRA_CA_CERTS = "/etc/ssl/certs/ca-certificates.crt";
30 description = lib.mdDoc ''
31 Additional configuration for Uptime Kuma, see
32 <https://github.com/louislam/uptime-kuma/wiki/Environment-Variables">
39 config = mkIf cfg.enable {
41 services.uptime-kuma.settings = {
42 DATA_DIR = "/var/lib/uptime-kuma/";
43 NODE_ENV = mkDefault "production";
46 systemd.services.uptime-kuma = {
47 description = "Uptime Kuma";
48 after = [ "network.target" ];
49 wantedBy = [ "multi-user.target" ];
50 environment = cfg.settings;
53 StateDirectory = "uptime-kuma";
55 ExecStart = "${cfg.package}/bin/uptime-kuma-server";
56 Restart = "on-failure";
58 ProtectSystem = "strict";
60 PrivateDevices = true;
61 ProtectHostname = true;
63 ProtectKernelTunables = true;
64 ProtectKernelModules = true;
65 ProtectKernelLogs = true;
66 ProtectControlGroups = true;
67 NoNewPrivileges = true;
68 RestrictRealtime = true;
69 RestrictSUIDSGID = true;