Help adding an directory to the $PATH variable

Hello i am still quite new to NixOS
First of this is my config file # Edit this configuration file to define what should be installed on# your sys - Pastebin.com
I am having trouble adding my users .local/bin directory to my path
or more accurately having the files inside the ~/.local/bin directory be available

i am using this code to add it

environment.variables = {
PATH = builtins.getEnv “PATH” + “:~/.local/bin”;
};
when i echo $PATH ~/.local/bin is included in there
maybe it gets added to late in the startup process
it is important that this gets added to the path before major applications like my i3 WM gets launched from an shell

i had it work on my 23.11 installation
but after updating
the files are no longer available
I am not using flakes and no homemanager

Thank you in advance for helping me
Kind regards.

Disclaimer - I know nothing about NixOS, I just read your post and started investigating for some reason :smile: . Here are my thoughts:

Looking at environment.variables it says

These variables will be set on shell initialisation (e.g. in /etc/profile).

AI tells me that /etc/profile is read at login. If you need PATH, or some other environment variable set as a service starts maybe you should rather have a look at adding it to its systemd unit file? Something like this maybe?

Thank you very much for looking into this i will try your suggestion but i have never worked with systemd before
what i tried since the creation of the post is [NixOS Search]

which did not work which is truly puzzling

But thank you in advance for looking into this

Don’t use getEnv in your config, it’s impure and will cause you more headaches.
How you approach this depends on whether you want those binaries available for interactive use, in scripts, in systemd services, etc.

Also, I believe ~ is a shell builtin, you probably want $HOME.

i would like to use the ~/.local/bin directory as an space for all of my scripts like an randomwallpaper set script or an rofi powermenu script.

Since i am currently launching all of these scripts in my i3 config i would like that i dont have to hardcode the paths with the ~/.local/bin

and just be able to use the name as if they were in the PATH variable.

I am sorry if these are just the ramblings of an uneducated person. But this is as far as i go with my knowledge

I am now using the environment.localBinInPath option
as found here: [NixOS Search]
credit goes to Reddit - Dive into anything
that helped me when i asked on reddit [Reddit - Dive into anything]

This is the only thing i am using to get my .local/bin directory into the PATH variable