3
submitted 11 months ago* (last edited 11 months ago) by [email protected] to c/[email protected]

I want to add custom commands to my PATH but am unable to get it working. So far I've installed home-manager and added the code below to my nix configuration.

imports = [
  ./hardware-configuration.nix
  
];

Then later on to add the item to PATH

home-manager.users.curtismchale = { pkgs, ... }: {
  home.stateVersion = "23.05";
  home.sessionPath = [
    "$HOME/Workspace/proudcity/proudcity-kubernetes/bin"
  ];
};

I have also tried $HOME/Workspace/proudcity/producity-kubernetes/bin/pc-kube but that doesn't change the issue.

I can see the commands installed at ~/Workspace/proudcity/proudcity-kubernetes/bin/pc-kube but when I type the expected command pc kube $command it says there is nothing installed in path and offers to install some programs that match pc for me.

you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 1 points 11 months ago

Not sure what the issue is, but I hope this helps:

  • Stuff added to home.sessionPath ends up in $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh, which (in my system, at least) is referenced from ~/.profile.
  • ~/.profile is only executed by login shells (ie. you have to logout and back in for it to be re-evaluated, or of course you can just source it)
  • bash ignores ~/.profile if there is a ~/.bash_profile or ~/.bash_login (IIRC)
this post was submitted on 28 Sep 2023
3 points (100.0% liked)

nixos

1245 readers
1 users here now

All about NixOS - https://nixos.org/

founded 4 years ago