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 state diverge from .env file #1591

Open
ayoubedd opened this issue Nov 15, 2024 · 4 comments
Open

dotenv state diverge from .env file #1591

ayoubedd opened this issue Nov 15, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@ayoubedd
Copy link

Describe the bug
am using devenv with direnv integration.
when updating .env devenv doesn't rebuild.

To reproduce
create a dummy .env with a couple of envs.
enable dotenv.

  ...
  dotenv.enable = true;
  ...

build shell, update .env. then devenv is out of sync.
not sure if its a devenv problem or a direnv problem.

Version
devenv 1.3.1

@ayoubedd ayoubedd added the bug Something isn't working label Nov 15, 2024
@domenkozar
Copy link
Member

@sandydoo huh, shouldn't that be detected via cache paths?

@sandydoo
Copy link
Member

I think we have a bug in our direnvrc where the paths are only picked up on the second reload.

@ayoubedd, I imagine if you reload the shell one time with direnv reload, it'll start registering changes to .env.

@ayoubedd
Copy link
Author

@sandydoo yes and no, when i reload it registers the change, but i have to do it every time i change .env file

@ayoubedd
Copy link
Author

ayoubedd commented Nov 26, 2024

@sandydoo apparently when i created a project recently but i used the flake template to instantiate devenv.

nix flake init --template github:cachix/devenv

it works just fine, it picks change to .env just fine

generated .envrc

if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
  source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

watch_file flake.nix
watch_file flake.lock
watch_file dedevenv.nix
if ! use flake . --impure
then
  echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi

it uses nix-direnv direenvrc rather than devenv's

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

3 participants