Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n8n: new service #1630

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

n8n: new service #1630

wants to merge 1 commit into from

Conversation

i-am-logger
Copy link

having an issue #1628 will appriciate the help.

@i-am-logger i-am-logger force-pushed the logger/n8n branch 5 times, most recently from 13c929f to f5fbdba Compare December 6, 2024 19:38
@i-am-logger
Copy link
Author

working, would appriciate a review

Copy link
Member

@sandydoo sandydoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @i-am-logger. I've requested a bunch of minor changes, but otherwise looks good overall.

Comment on lines +56 to +61
assertions = [{
assertion = cfg.enable;
message = ''
To use n8n, you have to enable it. (services.n8n.enable = true;)
'';
}];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to assert this.

Suggested change
assertions = [{
assertion = cfg.enable;
message = ''
To use n8n, you have to enable it. (services.n8n.enable = true;)
'';
}];

Comment on lines +7 to +8
with lib;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inherit is strongly preferred to with, as it can be statically type-checked. In this case, it can be removed entirely.

Suggested change
with lib;

{
options = {
services.n8n = {
enable = mkEnableOption "n8n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enable = mkEnableOption "n8n";
enable = lib.mkEnableOption "n8n";

type = types.str;
description = "Listen address";
default = "127.0.0.1";
example = "127.0.0.1";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
example = "127.0.0.1";


port = lib.mkOption {
type = types.port;
default = 5432;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default in their docs is 5678. 5432 is the default for postgres, so we should avoid using that.

Suggested change
default = 5432;
default = 5678;

};

processes.n8n = {
exec = "${pkgs.n8n}/bin/n8n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice to have a package option in the module to let people override the package used.

@@ -0,0 +1,7 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test that it launches, you can add a .test.sh script in this folder and curl a health endpoint of some kind. There are lots of examples of this in the repo.

@@ -0,0 +1,2 @@
{ ... }:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The n8n can be removed in favor of the test.

};

webhookUrl = lib.mkOption {
type = lib.types.str;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If null, then the WEBOOK_URL env var won't be set at all, as long as you remove the quotes when setting the env var later.

Suggested change
type = lib.types.str;
type = types.nullOr types.str;


webhookUrl = lib.mkOption {
type = lib.types.str;
default = "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default = "";
default = null;

@sandydoo
Copy link
Member

@i-am-logger, I think quite a few of the requested changes are also applicable to your previous PR. I'll be happy to review it once updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants