2024-01-10 04:11:11 +00:00
|
|
|
# n8n is an automation integration tool for connecting data from services
|
|
|
|
# together with triggers.
|
|
|
|
|
2024-04-20 13:42:06 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
{
|
2022-11-21 01:04:22 +00:00
|
|
|
|
2024-05-06 18:26:24 +00:00
|
|
|
config = lib.mkIf config.services.n8n.enable {
|
2022-12-21 21:18:03 +00:00
|
|
|
|
2024-05-06 18:38:03 +00:00
|
|
|
unfreePackages = [ "n8n" ];
|
|
|
|
|
2022-12-21 21:18:03 +00:00
|
|
|
services.n8n = {
|
|
|
|
settings = {
|
|
|
|
n8n = {
|
|
|
|
listenAddress = "127.0.0.1";
|
|
|
|
port = 5678;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-05-06 18:26:24 +00:00
|
|
|
# Configure Cloudflare DNS to point to this machine
|
|
|
|
services.cloudflare-dyndns.domains = [ config.hostnames.n8n ];
|
|
|
|
|
|
|
|
# Allow web traffic to Caddy
|
2024-04-20 13:42:06 +00:00
|
|
|
caddy.routes = [
|
|
|
|
{
|
2024-05-06 18:26:24 +00:00
|
|
|
match = [ { host = [ config.hostnames.n8n ]; } ];
|
2024-04-20 13:42:06 +00:00
|
|
|
handle = [
|
|
|
|
{
|
|
|
|
handler = "reverse_proxy";
|
2024-05-06 18:26:24 +00:00
|
|
|
upstreams = [ { dial = "localhost:${builtins.toString config.services.n8n.settings.n8n.port}"; } ];
|
2024-04-20 13:42:06 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
2022-12-21 21:18:03 +00:00
|
|
|
};
|
2022-11-21 01:04:22 +00:00
|
|
|
}
|