Environment variables: Difference between revisions

Pigs (talk | contribs)
m Add categories nixos and configuration
Jonboh (talk | contribs)
Added a way to fix "pam_env(sudo:session): Expandable variables must be wrapped in {}"
Tags: Mobile edit Mobile web edit
 
Line 55: Line 55:


==== Solution or workaround ====
==== Solution or workaround ====
Unknown.
Using Nix string literals can fix the problem by keeping the curly brackets after the nix evaluation.
 
<syntaxhighlight lang="nix">
Value:
{
  ...
  VARIABLE = ''''${VARIABLE}/path/to'';
  ...
}
</syntaxhighlight>
 
This will result in VARIABLE having the value <code>${VARIABLE}/path/to</code>
 
For example:
 
<syntaxhighlight lang="nix">
{
  environment.sessionVariables = rec {
    XDG_CACHE_HOME  = ''''${HOME}/.cache'';
    # ...
  };
# ...
}
</syntaxhighlight>
 


== Using variables from a Nix expression ==
== Using variables from a Nix expression ==