Files
nix-config/modules/apps/swag/default.nix
2024-08-23 12:00:51 -05:00

48 lines
1022 B
Nix

{ lib, config, ... }:
with lib;
let
cfg = config.nas-apps.swag;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
networking.firewall = {
allowedTCPPorts = [
cfg.httpPort
cfg.httpsPort
81
];
allowedUDPPorts = [
cfg.httpPort
cfg.httpsPort
81
];
};
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [
"${toString cfg.httpPort}:80"
"${toString cfg.httpsPort}:443"
"81:81"
];
extraOptions = [ "--cap-add=NET_ADMIN" ];
volumes = [ "${cfg.configPath}:/config" ];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
EMAIL = cfg.email;
URL = cfg.url;
VALIDATION = cfg.validation;
DNSPLUGIN = cfg.dnsPlugin;
SUBDOMAINS = cfg.subdomains;
DOCKER_MODS = "linuxserver/mods:swag-dashboard";
};
};
};
}