devenv icon indicating copy to clipboard operation
devenv copied to clipboard

dotenv is not working on v1.0.4

Open albertilagan opened this issue 1 year ago • 8 comments

Describe the bug

{
   dotenv.enable = true;
}

is not working after upgrading from v1.0.3 to v1.0.4

To reproduce

  1. upgrade devenv to v1.0.4,
  2. make sure dotenv.enable is set to true,
  3. run devenv up,
  4. envs from .env is not getting picked up.

Version devenv 1.0.4 (aarch64-darwin)

albertilagan avatar Apr 15 '24 22:04 albertilagan

Same here

DaniruKun avatar Apr 16 '24 17:04 DaniruKun

@albertilagan, I can't seem to replicate this. Am I missing anything?

This the setup I used: https://gist.github.com/sandydoo/640404ce7f88a0f5bbf3c27875ee1453

sandydoo avatar Apr 17 '24 13:04 sandydoo

I'm having the same issue, configuring the environment using a flake

MikeGeorgeff avatar Apr 19 '24 15:04 MikeGeorgeff

If you're experiencing this issue, please post gists with your devenv.nix, devenv.yaml, and devenv.lock files.

sandydoo avatar Apr 21 '24 17:04 sandydoo

If you're experiencing this issue, please post gists with your devenv.nix, devenv.yaml, and devenv.lock files.

https://gist.github.com/chocoladisco/9a60fdd7217aba5607c1e401393726af

This gives me the error message the dotenv file .env was not found

chocoladisco avatar Apr 22 '24 15:04 chocoladisco

@chocoladisco most probably it's because you use flake. And git flakes are not coping flies that are not added to git. Try to exclude .env from .gitignore and git add .env. It should "fix" an issue.

The other question is that you most probably don't want to include .env to git. I would love to know proper solution for this

prepor avatar Apr 23 '24 20:04 prepor

most probably it's because you use flake. And git flakes are not coping flies that are not added to git.

Correct. This is well-known design problem with flakes. I don't believe we have any workarounds for this, so if you rely on the dotenv integration, I'd recommend using the devenv cli.

sandydoo avatar Apr 24 '24 14:04 sandydoo

Yes, that is what I came up with eventually nodePackages.dotenv-cli + dotenv in .envrc after use flake ...

prepor avatar Apr 24 '24 15:04 prepor

Closing this because we can't get a response from the OP.

If you're using flakes, the dotenv integration will not work. A Nix flake requires you to track all of the files you need in your config. This is a design limitation/flaw of Nix flakes.

Use devenv's enterShell or direnv's .envrc to source your .env files.

sandydoo avatar May 23 '24 17:05 sandydoo