[email protected] error creating shell (NixOS)
What happened?
I am trying to add [email protected] and create a shell. I get the following error
❯ devbox init
❯ devbox add [email protected]
Info: Adding package "[email protected]" to devbox.json
...
❯ devbox shell
Info: Ensuring packages are installed.
✓ Computed the Devbox environment.
Error: nix: command error: nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' print-dev-env --json path:/home/shot/Develop/python-test/.devbox/gen/flake: 1 dependencies of derivation '/nix/store/zns1s5ycy576kiqym83vzhp1szxkpqqr-nix-shell-env.drv' failed to build: exit code 1
Happens with any version of the python package. Does not happen with package python312
Steps to reproduce
devbox initdevbox add [email protected]devbox shell
Command
shell
devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.4/.schema/devbox.schema.json",
"packages": ["[email protected]"],
"shell": {
"init_hook": [
"echo 'Welcome to devbox!' > /dev/null"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
Devbox version
0.13.4
Nix version
nix (Nix) 2.24.9
What system does this bug occur on?
Linux (x86-64)
Debug logs
❯ devbox shell
time=2024-10-20T13:31:01.759+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=.
time=2024-10-20T13:31:01.759+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json
time=2024-10-20T13:31:01.759+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:133 msg="config file found" path=/home/shot/Develop/python-test/devbox.json dur=372.496µs
time=2024-10-20T13:31:01.760+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:198 msg="package needs patching" pkg=python mode=auto
time=2024-10-20T13:31:01.760+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=.
time=2024-10-20T13:31:01.760+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json
time=2024-10-20T13:31:01.760+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:133 msg="config file found" path=/home/shot/Develop/python-test/devbox.json dur=122.379µs
time=2024-10-20T13:31:01.760+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:198 msg="package needs patching" pkg=python mode=auto
time=2024-10-20T13:31:01.788+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/nix.go:342 msg="nix --version --debug output" out="nix (Nix) 2.24.9\nSystem type: x86_64-linux\nAdditional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux\nFeatures: gc, signed-caches\nSystem configuration file: /etc/nix/nix.conf\nUser configuration files: /home/shot/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/shot/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/shot/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/shot/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf\nStore directory: /nix/store\nState directory: /nix/var/nix\nData directory: /nix/store/fpxbwqdma9rln9b6c21pz22famcvwsip-nix-2.24.9/share\n"
time=2024-10-20T13:31:01.788+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:60 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' eval --impure --raw --expr builtins.currentSystem" cmd.path=/run/current-system/sw/bin/nix
time=2024-10-20T13:31:01.803+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:67 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' eval --impure --raw --expr builtins.currentSystem" cmd.path=/run/current-system/sw/bin/nix cmd.pid=21406 cmd.code=0 cmd.dur=14.707267ms
time=2024-10-20T13:31:01.803+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=.
time=2024-10-20T13:31:01.803+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json
time=2024-10-20T13:31:01.803+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:133 msg="config file found" path=/home/shot/Develop/python-test/devbox.json dur=78.483µs
time=2024-10-20T13:31:01.803+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:198 msg="package needs patching" pkg=python mode=auto
time=2024-10-20T13:31:01.803+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:198 msg="package needs patching" pkg=python mode=auto
time=2024-10-20T13:31:01.803+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:198 msg="package needs patching" pkg=python mode=auto
Info: Ensuring packages are installed.
time=2024-10-20T13:31:01.803+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/plugin/plugin.go:85 msg="creating files for package" [email protected]
time=2024-10-20T13:31:01.804+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/plugin/plugin.go:128 msg="Creating file %q from contentPath: %q" /home/shot/Develop/python-test/.devbox/virtenv/python/bin/venvShellHook.sh=python/venvShellHook.sh
time=2024-10-20T13:31:02.316+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:198 msg="package needs patching" pkg=python mode=auto
time=2024-10-20T13:31:02.316+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:60 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' path-info --offline --json /nix/store/h3i0acpmr8mrjx07519xxmidv8mpax4y-python3-3.12.5" cmd.path=/run/current-system/sw/bin/nix
time=2024-10-20T13:31:02.353+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:67 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' path-info --offline --json /nix/store/h3i0acpmr8mrjx07519xxmidv8mpax4y-python3-3.12.5" cmd.path=/run/current-system/sw/bin/nix cmd.pid=21414 cmd.code=0 cmd.dur=37.256086ms
time=2024-10-20T13:31:02.354+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:198 msg="package needs patching" pkg=python mode=auto
time=2024-10-20T13:31:02.354+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/plugin/plugin.go:85 msg="creating files for package" pkg=python3
time=2024-10-20T13:31:02.354+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/plugin/plugin.go:128 msg="Creating file %q from contentPath: %q" /home/shot/Develop/python-test/.devbox/virtenv/python/bin/venvShellHook.sh=python/venvShellHook.sh
time=2024-10-20T13:31:02.354+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:198 msg="package needs patching" pkg=python mode=auto
time=2024-10-20T13:31:02.355+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/nix.go:85 msg="running print-dev-env cmd" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' print-dev-env --json path:/home/shot/Develop/python-test/.devbox/gen/flake"
time=2024-10-20T13:31:02.355+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:60 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' print-dev-env --json path:/home/shot/Develop/python-test/.devbox/gen/flake" cmd.path=/run/current-system/sw/bin/nix
⣽ Computing the Devbox environment...
time=2024-10-20T13:31:02.496+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:67 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' print-dev-env --json path:/home/shot/Develop/python-test/.devbox/gen/flake" cmd.path=/run/current-system/sw/bi✓ Computed the Devbox environment.
Error: nix: command error: nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' print-dev-env --json path:/home/shot/Develop/python-test/.devbox/gen/flake: attribute 'python3' missing: exit code 1
time=2024-10-20T13:31:02.496+02:00 level=ERROR source=go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:68 msg="command error" stderr="trace: evaluating glibc-patch.packages.x86_64-linux.python3\nerror:\n … while calling the 'derivationStrict' builtin\n at <nix/derivation-internal.nix>:34:12:\n 33|\n 34| strict = derivationStrict drvAttrs;\n | ^\n 35|\n\n … while evaluating derivation 'nix-shell'\n whose name attribute is located at /nix/store/j0jlb33bm31w347w43051hbffgh616jr-source/pkgs/stdenv/generic/make-derivation.nix:300:7\n\n … while evaluating attribute 'buildInputs' of derivation 'nix-shell'\n at /nix/store/j0jlb33bm31w347w43051hbffgh616jr-source/pkgs/stdenv/generic/make-derivation.nix:347:7:\n 346| depsHostHost = lib.elemAt (lib.elemAt dependencies 1) 0;\n 347| buildInputs = lib.elemAt (lib.elemAt dependencies 1) 1;\n | ^\n 348| depsTargetTarget = lib.elemAt (lib.elemAt dependencies 2) 0;\n\n (stack trace truncated; use '--show-trace' to show the full, detailed trace)\n\n error: attribute 'python3' missing\n at /nix/store/yhc8zv0a16j8gcg46yqmhmh8k55jdbfh-source/flake.nix:21:84:\n 20|\n 21| (builtins.trace \"evaluating glibc-patch.packages.x86_64-linux.python3\" glibc-patch.packages.x86_64-linux.python3)\n | ^\n 22| ];\n Did you mean python313?\n" execid=c50636727bf84d55998f8d430648f4e9 stack=<nil>
time=2024-10-20T13:31:02.496+02:00 level=ERROR source=go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:70 msg="command error" execid=c50636727bf84d55998f8d430648f4e9 stack=<nil>
time=2024-10-20T13:31:02.496+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:125 msg="searching for config file (including parent directories)" path=.
time=2024-10-20T13:31:02.496+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:146 msg="trying config file" path=devbox.json
time=2024-10-20T13:31:02.496+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devconfig/config.go:133 msg="config file found" path=/home/shot/Develop/python-test/devbox.json dur=78.873µs
time=2024-10-20T13:31:02.496+02:00 level=DEBUG source=go.jetpack.io/devbox/internal/devpkg/package.go:198 msg="package needs patching" pkg=python mode=auto
Can't reproduce this on Devbox 0.13.5 and Nix 2.24.9.
This looks like a corrupted flake file though. Have you tried deleting the .devbox folder and running devbox shell again?
Yes I have deleted .devbox and the lockfile with no luck.
cc @gcurtis
@shot-codes I managed to reproduce a similar error by doing:
devbox init
devbox add python@latest
devbox run -- echo test
# manually remove python from devbox.json
devbox add [email protected]
devbox run -- echo test
# error
The problem was that the generated flake was getting locked on an outdated version of the glibc-patch flake. I was able to fix it by deleting the .devbox directory, but that didn't seem to work for you.
If you're still seeing this bug, could you tar up the .devbox/gen/flake directory with tar -cf flake.tar .devbox/gen/flake and attach it to this issue?
I ran into the same issue, a workaround would be to use Python312Full instead that seemed to work for me.
@gcurtis thanks for looking into this, i rolled back my config as i had sole pressing work but will update again over the coming weekend and if I experience the same problem I'll tar it up for you.
Indeed, @kfmadrane using 'python312' seemed to work, though I'm not sure if those versions are patched by devbox? At least I recall experiencing issues with system libraries despite being able to install and launch a shell just fine
from the following flake:
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.4/.schema/devbox.schema.json",
"packages": [
"[email protected]",
],
"shell": {
"init_hook": [
". $VENV_DIR/bin/activate"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
I have also hit what appears to be the same problem. It happens when changing from one version of Python to another. It was introduced in version 0.13.0. Here is how to reproduce it:
rm -rf devbox.json devbox.lock .devbox
devbox init
devbox add [email protected]
devbox install
devbox add [email protected]
devbox install
Error:
Error: nix: command error: nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' print-dev-env --json path:/home/agrucza/apgrucza/test/.devbox/gen/flake: attribute 'python311' missing: exit code 1
If you run rm -rf .devbox/gen/flake before the final devbox install the error does not occur. Or if you run export DEVBOX_USE_VERSION=0.12.0 beforehand, the error does not occur either.
Thanks everyone for the detailed steps and logs. I think this is caused by the .devbox/gen/flake flake locking an old version of the glibc-patch flake. I'll push a fix for this today. In the meantime, doing rm -r .devbox/gen/flake should be a workaround.