Environment variables: Difference between revisions
imported>Symys No edit summary |
imported>Symys m Added clarification on the use of environment.variables vs other options. |
||
Line 1: | Line 1: | ||
== Configuration == | == Configuration == | ||
Environment variables can be set with [https://search.nixos.org/options?channel=unstable&show=environment.variables&from=0&size=50&sort=relevance&type=packages&query=environment.variables <code>environment.variables</code> ], <code>environment.sessionVariables</code>, and <code>environment.profileRelativeSessionVariables</code>. For example, for the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables XDG Base Directory Specification], the following could be set to <code>/etc/nixos/configuration.nix</code>: | Environment variables can be set with [https://search.nixos.org/options?channel=unstable&show=environment.variables&from=0&size=50&sort=relevance&type=packages&query=environment.variables <code>environment.variables</code> ], [ https://search.nixos.org/options?channel=23.11&show=environment.sessionVariables&from=0&size=50&sort=relevance&type=packages&query=environment.sessionVariables <code>environment.sessionVariables</code> ], and [ https://search.nixos.org/options?channel=unstable&show=environment.profileRelativeSessionVariables&from=0&size=50&sort=relevance&type=packages&query=environment.profileRelativeSessionVariables <code>environment.profileRelativeSessionVariables</code>] . environment.variables are global variables set on shell initialization, whereas environment.sessionVariables and environment.profileRelativeSessionVariables are initialized through PAM. For example, for the [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables XDG Base Directory Specification], the following could be set to <code>/etc/nixos/configuration.nix</code>: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> |