this post was submitted on 27 Jan 2026
8 points (100.0% liked)

Nix / NixOS

2623 readers
16 users here now

Main links

Videos

founded 2 years ago
MODERATORS
 

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).

you are viewing a single comment's thread
view the rest of the comments
[–] stupiv@lemmy.ml 3 points 2 weeks ago* (last edited 2 weeks ago)
  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.sessionPath will generate hm-session-vars files for different shells. You can read it by cat ~/.nix-profile/etc/profile.d/hm-session-vars.sh.

Enabling the shell is required for the respective hm-session-vars file to be sourced into the shell.