2022-10-30 15:09:59 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.uptime-kuma;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
meta.maintainers = [ lib.maintainers.julienmalka ];
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
options = {
|
|
|
|
services.uptime-kuma = {
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = mkEnableOption "Uptime Kuma, this assumes a reverse proxy to be set";
|
2022-10-30 15:09:59 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs "uptime-kuma" { };
|
2022-10-30 15:09:59 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
appriseSupport = mkEnableOption "apprise support for notifications";
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
settings = lib.mkOption {
|
2023-01-20 10:41:00 +00:00
|
|
|
type = lib.types.submodule { freeformType = with lib.types; attrsOf str; };
|
2022-10-30 15:09:59 +00:00
|
|
|
default = { };
|
|
|
|
example = {
|
|
|
|
PORT = "4000";
|
|
|
|
NODE_EXTRA_CA_CERTS = "/etc/ssl/certs/ca-certificates.crt";
|
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2022-10-30 15:09:59 +00:00
|
|
|
Additional configuration for Uptime Kuma, see
|
2023-01-11 07:51:40 +00:00
|
|
|
<https://github.com/louislam/uptime-kuma/wiki/Environment-Variables>
|
2022-10-30 15:09:59 +00:00
|
|
|
for supported values.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
services.uptime-kuma.settings = {
|
|
|
|
DATA_DIR = "/var/lib/uptime-kuma/";
|
|
|
|
NODE_ENV = mkDefault "production";
|
2023-05-24 13:37:59 +00:00
|
|
|
HOST = mkDefault "127.0.0.1";
|
|
|
|
PORT = mkDefault "3001";
|
2022-10-30 15:09:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.uptime-kuma = {
|
|
|
|
description = "Uptime Kuma";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
environment = cfg.settings;
|
2023-02-02 18:25:31 +00:00
|
|
|
path = with pkgs; [ unixtools.ping ] ++ lib.optional cfg.appriseSupport apprise;
|
2022-10-30 15:09:59 +00:00
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
StateDirectory = "uptime-kuma";
|
|
|
|
DynamicUser = true;
|
|
|
|
ExecStart = "${cfg.package}/bin/uptime-kuma-server";
|
|
|
|
Restart = "on-failure";
|
|
|
|
ProtectHome = true;
|
|
|
|
ProtectSystem = "strict";
|
|
|
|
PrivateTmp = true;
|
|
|
|
PrivateDevices = true;
|
|
|
|
ProtectHostname = true;
|
|
|
|
ProtectClock = true;
|
|
|
|
ProtectKernelTunables = true;
|
|
|
|
ProtectKernelModules = true;
|
|
|
|
ProtectKernelLogs = true;
|
|
|
|
ProtectControlGroups = true;
|
|
|
|
NoNewPrivileges = true;
|
|
|
|
RestrictRealtime = true;
|
|
|
|
RestrictSUIDSGID = true;
|
|
|
|
RemoveIPC = true;
|
|
|
|
PrivateMounts = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|