fix(mcp-gateway): change to user systemd service

Use systemd.user.services instead of systemd.services, default config
to ~/.config/mcp-gateway/gateway.yaml, and wantedBy default.target.
This commit is contained in:
2026-05-06 18:23:22 +03:00
parent e327504f4e
commit 743e6afde3

View File

@@ -7,7 +7,7 @@ in
{ {
options.services.mcp-gateway = { options.services.mcp-gateway = {
enable = lib.mkEnableOption "MCP Gateway service"; enable = lib.mkEnableOption "MCP Gateway user service";
package = lib.mkOption { package = lib.mkOption {
type = lib.types.package; type = lib.types.package;
@@ -16,22 +16,22 @@ in
}; };
configFile = lib.mkOption { configFile = lib.mkOption {
type = lib.types.path; type = lib.types.str;
default = "/etc/mcp-gateway/gateway.yaml"; default = "%h/.config/mcp-gateway/gateway.yaml";
description = "Path to the mcp-gateway configuration file."; description = "Path to the mcp-gateway configuration file.";
}; };
settings = lib.mkOption { settings = lib.mkOption {
type = with lib.types; attrsOf (attrsOf anything); type = with lib.types; attrsOf (attrsOf anything);
default = {}; default = {};
description = "Configuration options for the systemd service."; description = "Extra systemd service configuration options.";
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
systemd.services.mcp-gateway = { systemd.user.services.mcp-gateway = {
description = "MCP Gateway"; description = "MCP Gateway";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "default.target" ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
after = [ "network-online.target" ]; after = [ "network-online.target" ];