Skip to content

substituted variables from .env are not expanded #2176

@fdnt7

Description

@fdnt7

Describe the bug
When using dotenv.enable = true; in devenv.nix, variables that have substitutions are parsed literally without any expansion.

To reproduce

  1. Run devenv init in an empty directory
  2. Add dotenv.enable = true; in devenv.nix
  3. Create an .env file like so:
A=0
B=1
C=$A+$B

The C=$A+$B line is interchangable with C=${A}+${B}.
4. Enter the development shell, either via devenv shell or automatically if nix-direnv is present
5. Run echo $C. It should output 0+1, but it outputs $A+$B instead

Additional context:

  • I am not sure if this is intentional or not (as some parsers are deliberately made simple), but considering that in other tools I used (Docker, Docker Compose, Rust's sqlx and dotenvy) they are expanded, I figured it's worth reporting about this behaviour.
  • If this is intentional, please treat this as a feature request instead; Maybe a boolean like dotenv.expand as an option.

Version
devenv 1.9.0 (x86_64-linux)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions