Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotenv is not working on v1.0.4 #1135

Closed
albertilagan opened this issue Apr 15, 2024 · 9 comments
Closed

dotenv is not working on v1.0.4 #1135

albertilagan opened this issue Apr 15, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@albertilagan
Copy link

albertilagan commented Apr 15, 2024

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 albertilagan added the bug Something isn't working label Apr 15, 2024
@DaniruKun
Copy link

Same here

@sandydoo
Copy link
Member

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

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

@MikeGeorgeff
Copy link

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

@sandydoo
Copy link
Member

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

@chocoladisco
Copy link

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
Copy link

prepor commented Apr 23, 2024

@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
Copy link
Member

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
Copy link

prepor commented Apr 24, 2024

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

@sandydoo
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants