Hyprland/Sway need full path to scripts on non-NixOS

Hi All :wave:,

Problem

I have been using NixOS and Hyprland fine on my personal laptop (framework).
I have been given an Ubuntu laptop at work and cannot change the OS. Likewise, I have managed to get both Sway and recently Hyprland working using home-manager.

Where Sway and Hyprland were installed using apt (PikaOS repos for Hyprland). In Hyprland config, I have the following snippet to increase my volume:

bind=,XF86AudioRaiseVolume,exec, volume --inc
bind=,XF86AudioLowerVolume,exec, volume --dec

This works fine on my NixOS machine. However, this doesn’t work on Ubuntu.

A Solution

If I provide the full path to the script, this works fine, i.e.

bind=,XF86AudioRaiseVolume,exec, ${volume}/bin/volume --inc

So in the Hyprland config it looks like:

/nix/store/q1wm84g65smaq4agq7zp40q57x3534ni-volume/bin/volume --inc

So it seems like the binaries are not being made available in the path in my Ubuntu machine. In fish shell, it can find the volume binary

which volume
/home/haseebmajid/.nix-profile/bin/volume

Any ideas what I could be missing in my Non-NixOS machine?

Appendix

Logs from Hyprland (In Ubuntu)

Executing WAYLAND_DISPLAY=wayland-1 DISPLAY=:0 volume --dec
[LOG] Process Created with pid 338679

I was able to solve this issue by doing the following:

❯ bat ~/.config/environment.d/envvars.conf --plain
PATH="$PATH:/home/haseebmajid/.nix-profile/bin"

Since the Hyprland session is being started by GDM we need to update the environment variables it will pick up.

Wiki: Environment variables - ArchWiki

Reddit Thread: Hyprland/Sway needs full path to scripts on non-NixOS : NixOS