cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
3.47k stars 252 forks source link

dotenv is not working on v1.0.4 #1135

Open albertilagan opened 2 weeks ago

albertilagan commented 2 weeks ago

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)

DaniruKun commented 2 weeks ago

Same here

sandydoo commented 2 weeks ago

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

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

MikeGeorgeff commented 2 weeks ago

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

sandydoo commented 2 weeks ago

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

chocoladisco commented 1 week ago

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

prepor commented 1 week ago

@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

sandydoo commented 1 week ago

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.

prepor commented 1 week ago

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