summaryrefslogtreecommitdiff
path: root/hostnix/elmo/n8n.nix
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2025-07-30 13:46:32 -0400
committerJoe Mou <dev@mou.fo>2025-09-02 13:23:18 -0400
commit70efabc7729586eba04d6286d23cc05fa134c7ae (patch)
treeda8bbfa633acd46314a82ba396b72df2216ed0fb /hostnix/elmo/n8n.nix
parent199ccebbb0f927d3e8add46ab8c029ae849444eb (diff)
Minimal n8n serving (no HTTPS)
Diffstat (limited to 'hostnix/elmo/n8n.nix')
-rw-r--r--hostnix/elmo/n8n.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/hostnix/elmo/n8n.nix b/hostnix/elmo/n8n.nix
new file mode 100644
index 0000000..ad9435e
--- /dev/null
+++ b/hostnix/elmo/n8n.nix
@@ -0,0 +1,48 @@
+{ lib, pkgs, ... }:
+
+{
+ services.n8n = {
+ enable = true;
+ # TODO webhookUrl = "http://n8n.elmo.mou.fo";
+ };
+
+ systemd.services.n8n = {
+ environment = {
+ # services.n8n.settings is deprecated for environment variables.
+ N8N_CONFIG_FILES = lib.mkForce null;
+
+ N8N_LISTEN_ADDRESS = "::1";
+ N8N_PORT = "7856";
+
+ N8N_RUNNERS_ENABLED = "true";
+ N8N_RUNNERS_BROKER_LISTEN_ADDRESS = "::1";
+ N8N_RUNNERS_BROKER_PORT = "7857";
+
+ # TODO
+ N8N_SECURE_COOKIE = "false";
+
+ # https://docs.n8n.io/hosting/configuration/configuration-examples/isolation/
+ N8N_TEMPLATES_ENABLED = "false";
+ };
+
+ # Override the single instance of pkgs.n8n to use a custom derivation.
+ # Looks like n8n build fails with less than 16GB of memory.
+ # https://github.com/n8n-io/n8n/issues/14736
+ serviceConfig.ExecStart = let
+ pkg = pkgs.n8n.overrideAttrs(_: {
+ # https://github.com/n8n-io/n8n/blob/53594a90e438f25cea40b6e2510a2ba7c7ee9c32/.github/workflows/docker-build-push.yml
+ NODE_OPTIONS = "--max-old-space-size=7168";
+ });
+ in
+ lib.mkForce "${pkg}/bin/n8n";
+ };
+
+ services.nginx.virtualHosts."n8n.elmo.mou.fo" = {
+ # TODO enableACME = true;
+ # TODO forceSSL = true;
+ locations."/" = {
+ proxyPass = "http://[::1]:7856";
+ proxyWebsockets = true;
+ };
+ };
+}