Files
millerson-overlay.nix/modules/mcp-gateway.nix
Alexander Miroshnichenko 743e6afde3 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.
2026-05-06 18:23:22 +03:00

47 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.services.mcp-gateway;
package = pkgs.mcp-gateway;
in
{
options.services.mcp-gateway = {
enable = lib.mkEnableOption "MCP Gateway user service";
package = lib.mkOption {
type = lib.types.package;
default = package;
description = "The mcp-gateway package to use.";
};
configFile = lib.mkOption {
type = lib.types.str;
default = "%h/.config/mcp-gateway/gateway.yaml";
description = "Path to the mcp-gateway configuration file.";
};
settings = lib.mkOption {
type = with lib.types; attrsOf (attrsOf anything);
default = {};
description = "Extra systemd service configuration options.";
};
};
config = lib.mkIf cfg.enable {
systemd.user.services.mcp-gateway = {
description = "MCP Gateway";
wantedBy = [ "default.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${cfg.package}/bin/mcp-gateway --config ${cfg.configFile} serve";
Restart = "on-failure";
RestartSec = 5;
} // cfg.settings;
};
};
}