47 lines
1.2 KiB
Nix
47 lines
1.2 KiB
Nix
{ config, lib, ... }:
|
|
with lib;
|
|
let
|
|
common = config.selfhosted.common;
|
|
cfg = config.selfhosted.omni-tools;
|
|
in
|
|
{
|
|
options.selfhosted.omni-tools = {
|
|
enable = mkEnableOption "Enable ${cfg.name}";
|
|
name = mkOption {
|
|
type = types.str;
|
|
};
|
|
subdomain = mkOption {
|
|
type = types.str;
|
|
};
|
|
hostHttpPort = mkOption {
|
|
type = types.port;
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
virtualisation.oci-containers.containers."${cfg.name}" = {
|
|
image = "docker.io/iib0011/omni-tools:0.7.0";
|
|
ports = [
|
|
"0.0.0.0:${toString cfg.hostHttpPort}:80"
|
|
];
|
|
log-driver = "journald";
|
|
extraOptions = [
|
|
"--network=${common.network.name}"
|
|
"--health-cmd=wget -q -O /dev/null --tries=1 http://127.0.0.1/"
|
|
"--health-interval=30s"
|
|
"--health-timeout=10s"
|
|
"--health-retries=3"
|
|
"--health-start-period=20s"
|
|
];
|
|
};
|
|
|
|
systemd.services."${common.backend}-${cfg.name}" = {
|
|
serviceConfig = {
|
|
Restart = lib.mkOverride 90 "always";
|
|
};
|
|
wantedBy = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
|
partOf = [ "${common.backend}-${common.rootTarget.name}.target" ];
|
|
};
|
|
};
|
|
}
|