fix(deploy): resolve nix through service PATH
Core Architecture & Invariant CI / validate (pull_request) Successful in 16s

- Start the service via absolute /usr/bin/env so systemd does not need to resolve a nonstandard nix path itself.\n- Make the Nix binary directory an explicit unit placeholder and explain how operators set it.
This commit is contained in:
kiskaadee committed 2026-11-16 23:42:42 -05:00
1 parent 80dc58ea4a
commit 3aa198a787
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -177,7 +177,7 @@ The repository includes a unit template at [`deploy/lg-smtv-mcp.service`](deploy
sudoedit /etc/systemd/system/lg-smtv-mcp.service
```
3. Check where Nix is installed with `command -v nix`. System services do not inherit an interactive shell's profile, so edit the unit's `PATH` assignment to include the directory containing `nix` and the standard system binary directories.
3. Check where Nix is installed with `command -v nix`. Replace `<NixBinDir>` in the unit's `PATH` with the directory containing that `nix` executable, keeping the standard system binary directories in the value. The unit starts `/usr/bin/env` by its absolute path; `env` then finds `nix` using the service's configured `PATH`.
4. Reload systemd and start the service:
```bash
+2 -2
View File
@@ -8,8 +8,8 @@ Type=simple
User=<User>
WorkingDirectory=<WorkingDirectory>
EnvironmentFile=<WorkingDirectory>/.env
Environment="PATH=/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
ExecStart=nix develop --command python -m lg_smtv_mcp serve
Environment="PATH=<NixBinDir>:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ExecStart=/usr/bin/env nix develop --command python -m lg_smtv_mcp serve
Restart=on-failure
RestartSec=5s