Fix hermes-install: give the service an actual PATH
Confirmed live: "curl: command not found" inside hermes-install, despite curl being in environment.systemPackages. Real NixOS gotcha - systemPackages populates the interactive PATH (/run/current-system/sw/bin via /etc/profile), but systemd services get their own minimal PATH unless the unit is explicitly given one via `path = [...]`. The installer also shells out to git/node/python/gcc internally, so it's not just curl that was unreachable. Factored the package list (previously only in environment.systemPackages) into a shared `hermesInstallDeps` binding, used for both environment.systemPackages and hermes-install's `path`, so there's one list to keep in sync rather than two. set -euo pipefail (from the last fix) meant this failed loudly and retried instead of silently self-marking done - working as intended, just surfacing the next real bug in the chain. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
70c8c275c1
commit
04d1889101
1 file changed
+17
-8
+17
-8
@@ -26,6 +26,21 @@ let
|
||||
|
||||
stateDir = "/var/lib/hermes";
|
||||
useHostCache = cachePublicKey != "";
|
||||
|
||||
# Shared between environment.systemPackages (the interactive PATH) and
|
||||
# hermes-install's own `path` (below). environment.systemPackages does NOT
|
||||
# propagate into systemd services' PATH on its own - a bare `curl` inside
|
||||
# a systemd script only resolves if the unit is explicitly given a `path`,
|
||||
# which is what actually failed here (confirmed live: "curl: command not
|
||||
# found" from inside hermes-install, despite curl being in
|
||||
# systemPackages). The installer also shells out to git/node/python/gcc
|
||||
# internally, so the service needs all of this, not just curl.
|
||||
hermesInstallDeps = with pkgs; [
|
||||
git curl jq ripgrep fd tree htop
|
||||
uv nodejs ffmpeg
|
||||
direnv nix-direnv nix-output-monitor
|
||||
gcc gnumake pkg-config python3 xz
|
||||
];
|
||||
in
|
||||
{
|
||||
# Both disks are virtio-blk, including the one this very image boots from
|
||||
@@ -197,6 +212,7 @@ in
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
unitConfig.ConditionPathExists = "!${stateDir}/.hermes-installed";
|
||||
path = hermesInstallDeps;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "hermes";
|
||||
@@ -219,14 +235,7 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
git curl jq ripgrep fd tree htop
|
||||
uv nodejs ffmpeg
|
||||
direnv nix-direnv nix-output-monitor
|
||||
# Hermes's installer wants these: a C/C++ toolchain for native Node
|
||||
# modules (node-pty), plus xz for Node tarball extraction.
|
||||
gcc gnumake pkg-config python3 xz
|
||||
];
|
||||
environment.systemPackages = hermesInstallDeps;
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
|
||||
Reference in new issue
Block a user