feat: open listen addr and add firewall config
Some checks failed
Rust / build (push) Failing after 13s

This commit is contained in:
Harald Hoyer 2025-09-17 15:34:09 +02:00
parent 8fe3cda271
commit abc74ceb94

View file

@ -12,6 +12,12 @@ in
description = "Port to listen on for HTTP/SSE server"; description = "Port to listen on for HTTP/SSE server";
}; };
openFirewall = lib.mkOption {
default = false;
type = lib.types.bool;
description = "Whether to open the firewall for the specified port.";
};
user = lib.mkOption { user = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "cratedocs-mcp"; default = "cratedocs-mcp";
@ -26,13 +32,15 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ cfg.port ];
systemd.services.cratedocs-mcp = { systemd.services.cratedocs-mcp = {
description = "CrateDocs MCP server"; description = "CrateDocs MCP server";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${lib.getExe pkgs.cratedocs-mcp} http -a 127.0.0.1:${toString cfg.port}"; ExecStart = "${lib.getExe pkgs.cratedocs-mcp} http -a 0.0.0.0:${toString cfg.port}";
Restart = "always"; Restart = "always";
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;