Remove pinned UID for mcp user

UID 995 conflicted with sshd on orion. Let NixOS auto-assign the UID
for the mcp system user. Use systemd's %U specifier for XDG_RUNTIME_DIR
instead of the hardcoded UID.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 01:33:18 -07:00
parent 755450e72e
commit 53addc0ed1

View File

@@ -4,13 +4,9 @@
# and a systemd service for the agent daemon. # and a systemd service for the agent daemon.
{ pkgs, ... }: { pkgs, ... }:
let
mcpUid = 995;
in
{ {
users.users.mcp = { users.users.mcp = {
isSystemUser = true; isSystemUser = true;
uid = mcpUid; # Pin UID so systemd Environment references stay stable.
group = "mcp"; group = "mcp";
home = "/srv/mcp"; home = "/srv/mcp";
shell = pkgs.shadow; # nologin equivalent shell = pkgs.shadow; # nologin equivalent
@@ -42,7 +38,7 @@ in
Group = "mcp"; Group = "mcp";
Environment = [ Environment = [
"HOME=/srv/mcp" "HOME=/srv/mcp"
"XDG_RUNTIME_DIR=/run/user/${toString mcpUid}" "XDG_RUNTIME_DIR=/run/user/%U"
"PATH=/run/current-system/sw/bin:/usr/local/bin" "PATH=/run/current-system/sw/bin:/usr/local/bin"
]; ];