Jump to content

PATH env var: Difference between revisions

From Official NixOS Wiki
Jdorel (talk | contribs)
m Add sources
Cookie (talk | contribs)
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== PATH ==
== PATH ==


=== NIxOS Folders ===
=== NixOS Folders ===
NixOS bin folders are added to the PATH through PAM in https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/system-environment.nix
NixOS bin folders are added to the PATH through PAM in https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/system-environment.nix


Line 18: Line 18:


=== Adding folders for a specific user ===
=== Adding folders for a specific user ===
In `$HOME/.config/environment.d/*.conf`
In <code>$HOME/.config/environment.d/*.conf</code>


=== Sources ===
=== Sources ===
Line 24: Line 24:
* https://superuser.com/a/1649689
* https://superuser.com/a/1649689
* https://wiki.archlinux.org/title/Systemd/User#Environment_variables
* https://wiki.archlinux.org/title/Systemd/User#Environment_variables
=== Related articles ===
* [[Environment variables|https://wiki.nixos.org/wiki/Environment_variables]]
[[Category:Configuration]]

Latest revision as of 23:30, 5 March 2026

PATH

NixOS Folders

NixOS bin folders are added to the PATH through PAM in https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/system-environment.nix

Adding folders for all users

For systemd to include this PATH, you must include it in one of the following places.

In `/etc/environment.d` :

  environment.etc."environment.d/00-custom-path.conf".text = ''
    PATH="${PATH}:<path-to-new-folder>"
  '';

Or in `/etc/systemd/user.conf` :

systemd.user.extraConfig = ''
  DefaultEnvironment="PATH=<custom-path>"
'';

Adding folders for a specific user

In $HOME/.config/environment.d/*.conf

Sources