nixos/services.n8n: remove with lib;
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.n8n;
|
||||
format = pkgs.formats.json {};
|
||||
@@ -9,15 +6,15 @@ let
|
||||
in
|
||||
{
|
||||
options.services.n8n = {
|
||||
enable = mkEnableOption "n8n server";
|
||||
enable = lib.mkEnableOption "n8n server";
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Open ports in the firewall for the n8n web interface.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
settings = lib.mkOption {
|
||||
type = format.type;
|
||||
default = {};
|
||||
description = ''
|
||||
@@ -26,8 +23,8 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
webhookUrl = mkOption {
|
||||
type = types.str;
|
||||
webhookUrl = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
WEBHOOK_URL for n8n, in case we're running behind a reverse proxy.
|
||||
@@ -37,7 +34,7 @@ in
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.n8n.settings = {
|
||||
# We use this to open the firewall, so we need to know about the default at eval time
|
||||
port = lib.mkDefault 5678;
|
||||
@@ -85,7 +82,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ cfg.settings.port ];
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user