44 lines
1.1 KiB
Nix
44 lines
1.1 KiB
Nix
{ config, lib, ... }:
|
|
with lib;
|
|
let
|
|
common = config.selfhosted.common;
|
|
rootCfg = config.selfhosted.mihomo;
|
|
cfg = rootCfg.dashboard;
|
|
in
|
|
{
|
|
options.selfhosted.mihomo.dashboard = {
|
|
name = mkOption {
|
|
type = types.str;
|
|
};
|
|
subdomain = mkOption {
|
|
type = types.str;
|
|
};
|
|
hostHttpPort = mkOption {
|
|
type = types.port;
|
|
};
|
|
};
|
|
|
|
config = mkIf rootCfg.enable {
|
|
virtualisation.oci-containers.containers.${cfg.name} = {
|
|
image = "ghcr.io/zephyruso/zashboard:v3.19.0";
|
|
ports = [
|
|
"0.0.0.0:${toString cfg.hostHttpPort}:80"
|
|
];
|
|
log-driver = "journald";
|
|
extraOptions = [
|
|
"--network=${common.network.name}"
|
|
];
|
|
};
|
|
|
|
systemd.services."${common.backend}-${cfg.name}" = {
|
|
serviceConfig = {
|
|
Restart = lib.mkOverride 90 "always";
|
|
};
|
|
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
|
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
|
requires = [ "${common.backend}-${rootCfg.core.name}.service" ];
|
|
after = [ "${common.backend}-${rootCfg.core.name}.service" ];
|
|
};
|
|
};
|
|
}
|