From 8bd9b4b1dde1274b5f23171610eed7c3396dad96 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Fri, 5 Jun 2026 11:05:59 +0100 Subject: fix(systemd): add environment.d PATH so user units find nix binaries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The user-leaf tools (waybar, swayidle, swayr, mako, cliphist, inhibridge, wob, …) were migrated to the Nix home profile and their .service units reference them by bare name. The systemd user manager does not source ~/.zprofile, so its PATH lacked ~/.nix-profile/bin and every bare-name ExecStart failed with status=203/EXEC. The sway config's `systemctl --user import-environment PATH` raced with `systemctl --user start sway-session.target`; when the start won, units launched with the default PATH. environment.d is read at manager startup before any unit, closing the race deterministically. Pick up via fresh login/boot or `systemctl --user daemon-reexec`. --- dot_config/environment.d/10-nix-profile-path.conf | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 dot_config/environment.d/10-nix-profile-path.conf (limited to 'dot_config/environment.d') diff --git a/dot_config/environment.d/10-nix-profile-path.conf b/dot_config/environment.d/10-nix-profile-path.conf new file mode 100644 index 0000000..2e396d7 --- /dev/null +++ b/dot_config/environment.d/10-nix-profile-path.conf @@ -0,0 +1,22 @@ +# Prepend the Nix home-profile (and ~/.local/bin) to the systemd *user* +# manager's PATH at manager startup, before any unit in sway-session.target +# launches. +# +# Why this exists: most user-leaf tools (waybar, swayidle, swayr, mako, +# cliphist, inhibridge, wob, …) were migrated from pacman (/usr/bin) to the +# Nix home profile (~/.nix-profile/bin) and their .service units reference +# them by *bare* name, relying on $PATH resolution (see nix/host.nix). The +# systemd user manager does NOT source ~/.zprofile, so without this its PATH +# is only /usr/local/bin:/usr/bin:/bin and every bare-name ExecStart fails +# with status=203/EXEC. +# +# The sway config also runs `systemctl --user import-environment PATH`, but +# that is a fire-and-forget `exec` that races with +# `systemctl --user start sway-session.target`; if the start wins, the units +# launch with the default PATH. environment.d is read deterministically at +# manager start (before any unit), so it closes that race independently of +# the live session. +# +# Note: environment.d is only re-read on a fresh user manager (login/boot) or +# after `systemctl --user daemon-reexec`; it is not picked up mid-session. +PATH=${HOME}/.nix-profile/bin:${HOME}/.local/bin:${PATH} -- cgit v1.3.1