{ config, lib, ... }: let hostPort = 9004; subdomain = "n8n"; name = "n8n"; in { options.sysconfig.docker."${name}".enable = with lib; mkOption { type = with types; bool; default = false; }; config = lib.mkIf (config.sysconfig.docker."${name}".enable && config.sysconfig.docker.enable) { environment.etc."resolv.conf" = { enable = true; text = '' nameserver 127.0.0.1 nameserver 1.1.1.1 nameserver 1.0.0.1 options edns0 ''; user = "root"; mode = "0664"; }; networking.firewall.interfaces = { "ve-traefik" = { allowedTCPPorts = [ hostPort ]; }; }; virtualisation.oci-containers.containers."${name}" = { image = "docker.n8n.io/n8nio/n8n"; # unstable, waiting for 26.05 #pull = "newer"; hostname = "${subdomain}.esotericbytes.com"; networks = [ "docker-main" ]; labels = { "traefik.http.routers.${name}.entrypoints" = "localsecure"; "traefik.http.routers.${name}.rule" = "Host(`${subdomain}.esotericbytes.com`)"; "traefik.http.routers.${name}.service" = "${name}"; "traefik.http.routers.${name}.tls.certResolver" = "cloudflare"; "traefik.http.services.${name}.loadbalancer.server.url" = "http://192.168.100.10:${builtins.toString hostPort}"; }; extraOptions = lib.mkIf config.sysconfig.docker.nvidia [ "--ip=192.168.101.7" ]; ports = [ "${builtins.toString hostPort}:5678" ]; volumes = [ "vol_n8n:/etc/n8n" ]; environment = { GENERIC_TIMEZONE = "America/Chicago"; TZ = "America/Chicago"; N8N_DIAGNOSTICS_ENABLED = "false"; N8N_VERSION_NOTIFICATIONS_ENABLED = "false"; N8N_TEMPLATES_ENABLED = "false"; EXTERNAL_FRONTEND_HOOKS_URLS = ""; N8N_DIAGNOSTICS_CONFIG_FRONTEND = ""; N8N_DIAGNOSTICS_CONFIG_BACKEND = ""; N8N_SECURE_COOKIE = "false"; }; }; }; }