34 lines
622 B
Nix
Raw Normal View History

2023-02-20 20:45:56 -05:00
{ config, lib, ... }: {
2022-11-21 01:04:22 +00:00
2022-12-21 14:18:03 -07:00
options = {
n8nServer = lib.mkOption {
2022-12-22 00:31:25 +00:00
type = lib.types.nullOr lib.types.str;
2022-12-21 14:18:03 -07:00
description = "Hostname for n8n automation";
default = null;
2022-11-21 01:04:22 +00:00
};
};
2022-12-21 14:38:34 -07:00
config = lib.mkIf (config.n8nServer != null) {
2022-12-21 14:18:03 -07:00
services.n8n = {
enable = true;
settings = {
n8n = {
listenAddress = "127.0.0.1";
port = 5678;
};
};
};
caddy.routes = [{
match = [{ host = [ config.n8nServer ]; }];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:5678"; }];
}];
2022-11-21 01:04:22 +00:00
}];
2022-12-21 14:18:03 -07:00
};
2022-11-21 01:04:22 +00:00
}