nix/container/Change.nix

58 lines
1.2 KiB
Nix
Raw Normal View History

{
container,
lib,
config,
...
}@args:
with lib;
let
cfg = config.container.module.change;
in
{
options = {
container.module.change = {
enable = mkEnableOption "Change detection service";
address = mkOption {
default = "10.1.0.41";
type = types.str;
};
port = mkOption {
default = 5000;
type = types.int;
};
domain = mkOption {
default = "change.${config.container.domain}";
type = types.str;
};
storage = mkOption {
default = "${config.container.storage}/change";
type = types.str;
};
};
};
2024-06-25 04:04:39 +03:00
config = mkIf cfg.enable {
2024-10-14 04:51:19 +03:00
systemd.tmpfiles.rules = container.mkContainerDir cfg [ "data" ];
2024-06-25 04:04:39 +03:00
containers.change = container.mkContainer cfg {
bindMounts = {
"/var/lib/changedetection-io" = {
hostPath = "${cfg.storage}/data";
isReadOnly = false;
};
};
config =
{ ... }:
container.mkContainerConfig cfg {
services.changedetection-io = {
enable = true;
baseURL = cfg.domain;
behindProxy = true;
listenAddress = cfg.address;
};
};
};
};
}