File tree Expand file tree Collapse file tree 6 files changed +114
-0
lines changed
docs/individual-docs/services Expand file tree Collapse file tree 6 files changed +114
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+
3
+ [ comment ] : # ( Please add your documentation on top of this line )
4
+
5
+ @AUTOGEN_OPTIONS@
Original file line number Diff line number Diff line change
1
+ { pkgs , ... } :
2
+
3
+ {
4
+ packages = [ pkgs . coreutils ] ;
5
+ services . n8n = {
6
+ enable = true ;
7
+ address = "0.0.0.0" ;
8
+ port = 5432 ;
9
+ # settings = {
10
+
11
+ # }
12
+ # webhookUrl = "";
13
+ } ;
14
+ }
Original file line number Diff line number Diff line change
1
+ allowUnfree : true
Original file line number Diff line number Diff line change
1
+ { config
2
+ , lib
3
+ , pkgs
4
+ , ...
5
+ } :
6
+
7
+ with lib ;
8
+
9
+ let
10
+ inherit ( lib ) types ;
11
+ cfg = config . services . n8n ;
12
+ format = pkgs . formats . json { } ;
13
+ configFile = format . generate "n8n.json" cfg . settings ;
14
+ in
15
+ {
16
+ options = {
17
+ services . n8n = {
18
+ enable = mkEnableOption "n8n" ;
19
+
20
+ address = lib . mkOption {
21
+ type = types . str ;
22
+ description = "Listen address" ;
23
+ default = "127.0.0.1" ;
24
+ example = "127.0.0.1" ;
25
+ } ;
26
+
27
+ port = lib . mkOption {
28
+ type = types . port ;
29
+ default = 5432 ;
30
+ description = ''
31
+ The TCP port to accept connections.
32
+ '' ;
33
+ } ;
34
+
35
+ webhookUrl = lib . mkOption {
36
+ type = lib . types . str ;
37
+ default = "" ;
38
+ description = ''
39
+ WEBHOOK_URL for n8n, in case we're running behind a reverse proxy.
40
+ This cannot be set through configuration and must reside in an environment variable.
41
+ '' ;
42
+ } ;
43
+
44
+ settings = lib . mkOption {
45
+ type = format . type ;
46
+ default = { } ;
47
+ description = ''
48
+ Configuration for n8n, see <https://docs.n8n.io/hosting/environment-variables/configuration-methods/>
49
+ for supported values.
50
+ '' ;
51
+ } ;
52
+ } ;
53
+ } ;
54
+
55
+ config = lib . mkIf cfg . enable {
56
+ assertions = [ {
57
+ assertion = cfg . enable ;
58
+ message = ''
59
+ To use n8n, you have to enable it. (services.n8n.enable = true;)
60
+ '' ;
61
+ } ] ;
62
+ env = {
63
+ N8N_PORT = cfg . port ;
64
+ N8N_LISTEN_ADDRESS = cfg . address ;
65
+ WEBHOOK_URL = "${ cfg . webhookUrl } " ;
66
+ N8N_CONFIG_FILES = "${ configFile } " ;
67
+ } ;
68
+
69
+ processes . n8n = {
70
+ exec = "${ pkgs . n8n } /bin/n8n" ;
71
+
72
+ process-compose = {
73
+ readiness_probe = {
74
+ exec . command = "${ pkgs . curl } /bin/curl -f -k ${ cfg . address } :${ toString cfg . port } " ;
75
+ initial_delay_seconds = 1 ;
76
+ period_seconds = 10 ;
77
+ timeout_seconds = 2 ;
78
+ success_threshold = 1 ;
79
+ failure_threshold = 5 ;
80
+ } ;
81
+
82
+ availability . restart = "on_failure" ;
83
+ } ;
84
+ } ;
85
+ } ;
86
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ services . n8n = {
3
+ enable = true ;
4
+ address = "0.0.0.0" ;
5
+ port = 5678 ;
6
+ } ;
7
+ }
Original file line number Diff line number Diff line change
1
+ allowUnfree : true
You can’t perform that action at this time.
0 commit comments