From ea9cf8b5883b3056a8f258bcfe4d39d50e39fcfe Mon Sep 17 00:00:00 2001 From: Alexander Miroshnichenko Date: Wed, 6 May 2026 18:38:47 +0300 Subject: [PATCH] feat(mcp-gateway): add systemd user unit file to package Install mcp-gateway.service to $out/lib/systemd/user/ so it can be activated via systemd.user.packages. The service runs: mcp-gateway --config ~/.config/mcp-gateway/gateway.yaml serve --- flake.nix | 4 --- modules/mcp-gateway.nix | 46 -------------------------------- packages/mcp-gateway/package.nix | 18 +++++++++++++ 3 files changed, 18 insertions(+), 50 deletions(-) delete mode 100644 modules/mcp-gateway.nix diff --git a/flake.nix b/flake.nix index ed60dad..d3b10a5 100644 --- a/flake.nix +++ b/flake.nix @@ -55,10 +55,6 @@ // { packages = inputs.nixpkgs.lib.recursiveUpdate blueprintOutputs.packages extraPackages; - nixosModules = { - mcp-gateway = ./modules/mcp-gateway.nix; - }; - overlays = { default = import ./overlays { inherit (blueprintOutputs) packages; diff --git a/modules/mcp-gateway.nix b/modules/mcp-gateway.nix deleted file mode 100644 index e465e0a..0000000 --- a/modules/mcp-gateway.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ 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; - }; - }; -} diff --git a/packages/mcp-gateway/package.nix b/packages/mcp-gateway/package.nix index 4e1618e..5751273 100644 --- a/packages/mcp-gateway/package.nix +++ b/packages/mcp-gateway/package.nix @@ -27,6 +27,24 @@ rustPlatform.buildRustPackage rec { doCheck = false; + postInstall = '' + install -Dm644 /dev/stdout $out/lib/systemd/user/mcp-gateway.service <