nix/container/Status.nix

68 lines
1.5 KiB
Nix
Raw Normal View History

{
container,
lib,
config,
...
}:
with lib;
let
cfg = config.container.module.status;
in
{
options = {
container.module.status = {
enable = mkEnableOption "Status monitor.";
address = mkOption {
default = "10.1.0.22";
type = types.str;
};
port = mkOption {
default = 3001;
type = types.int;
};
domain = mkOption {
default = "status.${config.container.domain}";
type = types.str;
};
storage = mkOption {
default = "${config.container.storage}/status";
type = types.str;
};
};
};
2024-06-09 23:35:53 +03:00
config = mkIf cfg.enable {
2024-10-14 04:51:19 +03:00
systemd.tmpfiles.rules = container.mkContainerDir cfg [ "data" ];
2024-06-23 16:21:40 +03:00
containers.status = container.mkContainer cfg {
bindMounts = {
"/var/lib/uptime-kuma" = {
hostPath = "${cfg.storage}/data";
isReadOnly = false;
};
};
2024-06-09 23:35:53 +03:00
config =
{ lib, ... }:
container.mkContainerConfig cfg {
networking = {
2024-10-14 04:51:19 +03:00
nameservers = mkForce [ config.container.module.dns.address ];
};
2024-06-25 04:04:39 +03:00
services.uptime-kuma = {
enable = true;
settings = {
DATA_DIR = "/var/lib/uptime-kuma/";
HOST = cfg.address;
PORT = toString cfg.port;
};
};
2024-06-25 04:04:39 +03:00
systemd.services.uptime-kuma = {
serviceConfig.DynamicUser = mkForce false;
};
};
};
};
2024-06-09 23:35:53 +03:00
}