Closed Lagoja closed 4 days ago
@savil this issue is related to the change in init_hooks that we discussed
hmm this works:
cat devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.0.0-dev/.schema/devbox.schema.json",
"packages": ["ripgrep@latest"],
"shell": {
"init_hook": [
". $DEVBOX_PROJECT_ROOT/development.env"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
So, I think the working-directory of the init-hooks needs to be adjusted to be in the DEVBOX_PROJECT_ROOT?
It shouldn't need to be adjusted, since scripts execute in the root directory by default. You can validate by running pwd
in the line just above the init_hook
Testing with the new build that disables re-running init_hooks, the following devbox.json works as expected:
{
"packages": [
"ripgrep@latest",
"nodejs@21"
],
"shell": {
"init_hook": [
"pwd",
"source ./development.env"
],
"scripts": {
"test": [
"echo 'Testing for init_hook'"
]
}
}
}
Rerunning init_hooks is fixed in 0.12.0, so we can close this issue
What happened?
Running a
devbox run
script inside a devbox shell can causeFile Not Found
errors when sourcing a file inside the init hook.Steps to reproduce
Create the devbox.json and development.env file below: devbox.json
development.env
Run
devbox shell
Run
devbox run test
inside the shellDevbox run fails with error:
Command
run
devbox.json
Devbox version
0.10.7
Nix version
nix (Nix) 2.20.5, 2.18.1
What system does this bug occur on?
macOS (Apple Silicon)
Debug logs