I’m trying to get my scripts to have precedence over the home manager stuff.
Do you happen to know how to do that?
(not sure it’s relevant, but I’m using home-manager in tumbleweed, not nixos)
edit:
Thanks for the replies - I finally got time to investigate this properly so here’s a few notes (hopefully useful for someone somehow).
~/.nix-profile/bin is added (prepended) to the path by the files in /nix/var/nix/profiles/default/etc/profile.d/, sourced every time my shell (fish, but it should be the same for others) starts (rg -L nix/profiles /etc 2> /dev/null for how they are sourced).
The path I set in homemanager (via home.sessionPath, which is added (prepended) to home.sessionSearchVariables.PATH) ends up in .nix-profile/etc/profile.d/hm-session-vars.sh, which is sourced via ~/.profile once per session (I think? certainly not when I start fish or bash). This may be due to how I installed home-manager… I don’t recall.
So… the solution is to set the path again in my shell (possibly via programs.fish.shellInitLast - I din’t check yet).
programs.fish.enable = true; # Enable your shell home.sessionPath = ["$HOME/.local/bin"];I found the option by searching for “PATH” at home-manager-options.extranix.com.
home.sessionPathwill generatehm-session-varsfiles for different shells. You can read it bycat ~/.nix-profile/etc/profile.d/hm-session-vars.sh.Enabling the shell is required for the respective
hm-session-varsfile to be sourced into the shell.As far as I’m aware Home Manager doesn’t set PATH at all, though the Nix installer does. I’m not sure where it adds to the PATH, it might edit
/etc/profileor something like that. You should be able to change it since you’re not on NixOS.Alternatively this should also do the trick, although it’s a bit ugly:
home.sessionVariables.PATH = "$HOME/.local/bin:$PATH";You could use a shell dotfile (.bashrc for instance) for that.
Home manager even allows you to manage them through it, via https://nix-community.github.io/home-manager/options.xhtml#opt-home.file



