Skip to content

About env var evaluation (documentation) #336

@yangm97

Description

@yangm97

It may be obvious to some but, due the way evaluation works, you need to escape characters such as & in double quotes, otherwise evaluation fails silently and the variable doesn't get set.

For instance, this works:

devshells.default.env = [
  {
    name = "MY_VAR";
    eval = "\"foo & bar\"";  # Wrap in quotes to ensure it's passed correctly
  }
];

But this doesn't:

devshells.default.env = [
  {
    name = "MY_VAR";
    eval = "foo & bar";  # Shell builds and loads but MY_VAR won't be shown in the export list, in addition to not being set   
  }
];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions