Environment variables: Difference between revisions

imported>Yuu
imported>Yuu
No edit summary
Line 1: Line 1:
= Configuration =
== Configuration ==


Environment variables can be set with <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 <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>:
Line 22: Line 22:
</syntaxhighlight>
</syntaxhighlight>


= Troubleshooting =
== Troubleshooting ==


== sudo[3424]: pam_env(sudo:session): Expandable variables must be wrapped in {} <$ENVIRONMENT_VARIABLE/path/to> - ignoring ==
=== sudo[3424]: pam_env(sudo:session): Expandable variables must be wrapped in {} <$VARIABLE/path/to> - ignoring ===
 
=== Description ===


Error logs may be found with <code>journalctl -xb -p3</code> regarding the no presence of curly braces <code>{}</code> for variable expansion.
Error logs may be found with <code>journalctl -xb -p3</code> regarding the no presence of curly braces <code>{}</code> for variable expansion.


<syntaxhighlight lang="shell">
<syntaxhighlight lang="shell">
sudo[3424]: pam_env(sudo:session): Expandable variables must be wrapped in {} <$ENVIRONMENT_VARIABLE/path/to> - ignoring
sudo[3424]: pam_env(sudo:session): Expandable variables must be wrapped in {} <$VARIABLE/path/to> - ignoring
</syntaxhighlight>
</syntaxhighlight>


Line 40: Line 38:
{
{
   ...
   ...
   ENVIRONMENT_VARIABLE = "${ENVIRONMENT_VARIABLE}/path/to";
   VARIABLE = "${VARIABLE}/path/to";
   ...
   ...
}
}
Line 47: Line 45:
This indicates that the curly braces are getting removed at a later stage.
This indicates that the curly braces are getting removed at a later stage.


=== Solution or workaround ===
==== Solution or workaround ====
Unknown.
Unknown.