Adding programs to PATH: Difference between revisions
m Add shell session example to declarative Nix flake devshell Tags: Mobile edit Mobile web edit Visual edit |
Explain PATH Tags: Mobile edit Mobile web edit Visual edit |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Tutorial]] | |||
Here is a collection of methods to add a program to the <code>PATH</code> environment variable with [[Nix (package manager)]] with packages from [[Nixpkgs]]. | Here is a collection of methods to add a program to the <code>PATH</code> environment variable with [[Nix (package manager)]] with packages from [[Nixpkgs]]. | ||
The <code>PATH</code> environment variable (often referred to as "the PATH") is an environment variable that tells programs where to find other programs. When you run a command <code>hello</code> in a bash shell, it basically searches for an executable named <code>hello</code> in every directory listed in <code>PATH</code>. | |||
The NixOS method supports installing [[udev]] rules, which may be required for programs interacting with hardware. Services should be enabled and configured with NixOS options rather than by adding them manually to <code>environment.systemPackages</code>. | The NixOS method supports installing [[udev]] rules, which may be required for programs interacting with hardware. Services should be enabled and configured with NixOS options rather than by adding them manually to <code>environment.systemPackages</code>. | ||
| Line 7: | Line 11: | ||
== Persistent == | == Persistent == | ||
These methods install the packages globally (not local to a specific development shell), persist the installation between reboots and | These methods install the packages globally (not local to a specific development shell), persist the installation between reboots and symlink paths together into a specific directory (see the NixOS options {{Nixos:option|environment.systemPackages}} and {{Nixos:option|environment.pathsToLink}} for details). | ||
=== NixOS === | === NixOS === | ||