fix(deploy): resolve nix through service PATH
- 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:
1 parent
53af1cc988
commit
96068cacf2
2 files changed
+3
-3
No files matched your search
@@ -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
|
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:
|
4. Reload systemd and start the service:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ Type=simple
|
|||||||
User=<User>
|
User=<User>
|
||||||
WorkingDirectory=<WorkingDirectory>
|
WorkingDirectory=<WorkingDirectory>
|
||||||
EnvironmentFile=<WorkingDirectory>/.env
|
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"
|
Environment="PATH=<NixBinDir>:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
ExecStart=nix develop --command python -m lg_smtv_mcp serve
|
ExecStart=/usr/bin/env nix develop --command python -m lg_smtv_mcp serve
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5s
|
RestartSec=5s
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user