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

file referenced by env_from not existing should not stop devbox enabling the environment #2504

Open
t-monaghan opened this issue Feb 5, 2025 · 0 comments
Labels
bug Something isn't working triage Issue needs triage

Comments

@t-monaghan
Copy link
Contributor

What happened?

I get a papercut on first time use of projects using devbox's env_from where the typically untracked file doesn't exist, and due to this devbox will exit early. This can be frustrating as it doesn't provide the chance to ensure this file exists with a script in the init_hook. I understand that parsing env_from prior to executing the scripts in init_hook is required, but I would expect that if the files referenced by env_from do not exist devbox might print a warning, and continue setting up the environment.

Steps to reproduce

  1. devbox init && devbox generate direnv
  2. echo "somevar=" >> .private.example
  3. echo '{
    "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.7/.schema/devbox.schema.json",
    "env_from": ".private.env",
    "shell": {
    "init_hook": "cp -n .private.example .private.env"
    }
    }' > devbox.json

Results in the below

direnv: loading ~/dev/scratch/.envrc
direnv: using devbox
Info: Ensuring packages are installed.

Error: failed parsing .private.env file. Error: failed to open file: /Users/tom.monaghan/dev/scratch/.private.env

Command

shell

devbox.json

{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.7/.schema/devbox.schema.json",
  "env_from": ".private.env",
  "shell": {
    "init_hook": "cp -n .private.example .private.env"
  }
}

Devbox version

0.13.7

Nix version

nix (Nix) 2.24.10

What system does this bug occur on?

macOS (Apple Silicon)

Debug logs

No response

@t-monaghan t-monaghan added bug Something isn't working triage Issue needs triage labels Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs triage
Development

No branches or pull requests

1 participant