mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
nixos/uptime-kuma: init module
This commit is contained in:
parent
2e4f37bbbd
commit
b54ae5a868
6 changed files with 106 additions and 0 deletions
76
nixos/modules/services/monitoring/uptime-kuma.nix
Normal file
76
nixos/modules/services/monitoring/uptime-kuma.nix
Normal file
|
@ -0,0 +1,76 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.uptime-kuma;
|
||||
in
|
||||
{
|
||||
|
||||
options = {
|
||||
services.uptime-kuma = {
|
||||
enable = mkEnableOption (mdDoc "Uptime Kuma, this assumes a reverse proxy to be set.");
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
example = literalExpression "pkgs.uptime-kuma";
|
||||
default = pkgs.uptime-kuma;
|
||||
defaultText = "pkgs.uptime-kuma";
|
||||
description = lib.mdDoc "Uptime Kuma package to use.";
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type =
|
||||
lib.types.submodule { freeformType = with lib.types; attrsOf str; };
|
||||
default = { };
|
||||
example = {
|
||||
PORT = "4000";
|
||||
NODE_EXTRA_CA_CERTS = "/etc/ssl/certs/ca-certificates.crt";
|
||||
};
|
||||
description = lib.mdDoc ''
|
||||
Additional configuration for Uptime Kuma, see
|
||||
<https://github.com/louislam/uptime-kuma/wiki/Environment-Variables">
|
||||
for supported values.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
services.uptime-kuma.settings = {
|
||||
DATA_DIR = "/var/lib/uptime-kuma/";
|
||||
NODE_ENV = mkDefault "production";
|
||||
};
|
||||
|
||||
systemd.services.uptime-kuma = {
|
||||
description = "Uptime Kuma";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = cfg.settings;
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue