Open Vilsol opened 2 weeks ago
I have defined a local flake that has impurities, so it must be built using the --impure flag.
--impure
Running nix shell --impure works fine.
nix shell --impure
I would expect that unless --pure is passed to devbox shell it would build flakes as impure.
--pure
devbox shell
It seems that the issue is a missing --impure here: https://github.com/jetify-com/devbox/blob/main/internal/nix/command.go#L31
I would be willing to make a PR to add it if --pure is unspecified.
{ inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; outputs = { self, nixpkgs }: { packages.x86_64-linux.hello = ( builtins.trace builtins.currentSystem nixpkgs.legacyPackages.x86_64-linux.hello ); packages.x86_64-linux.default = self.packages.x86_64-linux.hello; }; }
shell
{ "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.11.0/.schema/devbox.schema.json", "packages": [ "./#hello" ] }
0.11.0
nix (Nix) 2.18.2
Linux (x86-64)
DEVBOX_DEBUG=1 devbox shell 2024/06/12 12:28:05 findProjectDir: path is 2024/06/12 12:28:05 finding devbox config in dir: /home/vilsol/tmp/devbox-flake-bug 2024/06/12 12:28:05 findProjectDir: path is 2024/06/12 12:28:05 finding devbox config in dir: /home/vilsol/tmp/devbox-flake-bug 2024/06/12 12:28:06 nix --version --debug output: nix (Nix) 2.18.2 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/vilsol/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/vilsol/.local/share/flatpak/exports/etc/xdg/nix/nix.conf:/var/lib/flatpak/exports/etc/xdg/nix/nix.conf:/home/vilsol/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/vilsol/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/vilsol/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf:/nix/store/wbflpsk6a3k26pr9hrsl6bpvm80brxrr-gnome-settings-daemon-46.0/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/fwrdsdlpqfhm6p4z9dk19vniw14mmq3s-nix-2.18.2/share 2024/06/12 12:28:06 findProjectDir: path is 2024/06/12 12:28:06 finding devbox config in dir: /home/vilsol/tmp/devbox-flake-bug Info: Ensuring packages are installed. Warning: Outputs for ./#hello are not in lockfile. Fetching store paths from nix, this may take a while 2024/06/12 12:28:06 Running cmd /run/current-system/sw/bin/nix path-info path:/home/vilsol/tmp/devbox-flake-bug#hello --json --impure --extra-experimental-features ca-derivations --option experimental-features nix-command flakes fetch-closure 2024/06/12 12:28:06 Running cmd /run/current-system/sw/bin/nix path-info --offline --json /nix/store/yh6x9ia5kxxw3w90vkb09vqgfvhb416k-hello-2.12.1 --extra-experimental-features ca-derivations --option experimental-features nix-command flakes fetch-closure 2024/06/12 12:28:06 running command: /run/current-system/sw/bin/nix search path:/home/vilsol/tmp/devbox-flake-bug#hello ^ --json --extra-experimental-features ca-derivations --option experimental-features nix-command flakes fetch-closure Error: execute template flake_remove_nixpkgs.nix.tmpl: template: flake_remove_nixpkgs.nix.tmpl:69:22: executing "flake_remove_nixpkgs.nix.tmpl" at <.BuildInputs>: error calling BuildInputs: error searching for pkg path:/home/vilsol/tmp/devbox-flake-bug#hello: nix search exit code: 1, stderr: evaluating 'packages.x86_64-linux.hello'... error: … while calling the 'trace' builtin at /nix/store/7nfpvfsrp9w1p7w8qsgfhkkxq0dpi3hk-source/flake.nix:6:9: 5| packages.x86_64-linux.hello = ( 6| builtins.trace builtins.currentSystem nixpkgs.legacyPackages.x86_64-linux.hello | ^ 7| ); error: attribute 'currentSystem' missing at /nix/store/7nfpvfsrp9w1p7w8qsgfhkkxq0dpi3hk-source/flake.nix:6:24: 5| packages.x86_64-linux.hello = ( 6| builtins.trace builtins.currentSystem nixpkgs.legacyPackages.x86_64-linux.hello | ^ 7| ); , original error: exit status 1 2024/06/12 12:28:06 ExecutionID:8aba4809395540b5a020c79db7354609 execute template flake_remove_nixpkgs.nix.tmpl: template: flake_remove_nixpkgs.nix.tmpl:69:22: executing "flake_remove_nixpkgs.nix.tmpl" at <.BuildInputs>: error calling BuildInputs: error searching for pkg path:/home/vilsol/tmp/devbox-flake-bug#hello: nix search exit code: 1, stderr: evaluating 'packages.x86_64-linux.hello'... error: … while calling the 'trace' builtin at /nix/store/7nfpvfsrp9w1p7w8qsgfhkkxq0dpi3hk-source/flake.nix:6:9: 5| packages.x86_64-linux.hello = ( 6| builtins.trace builtins.currentSystem nixpkgs.legacyPackages.x86_64-linux.hello | ^ 7| ); error: attribute 'currentSystem' missing at /nix/store/7nfpvfsrp9w1p7w8qsgfhkkxq0dpi3hk-source/flake.nix:6:24: 5| packages.x86_64-linux.hello = ( 6| builtins.trace builtins.currentSystem nixpkgs.legacyPackages.x86_64-linux.hello | ^ 7| ); , original error: exit status 1 go.jetpack.io/devbox/internal/shellgen.writeFromTemplate go.jetpack.io/devbox/internal/shellgen/generate.go:92 go.jetpack.io/devbox/internal/shellgen.makeFlakeFile go.jetpack.io/devbox/internal/shellgen/generate.go:191 go.jetpack.io/devbox/internal/shellgen.GenerateForPrintEnv go.jetpack.io/devbox/internal/shellgen/generate.go:62 go.jetpack.io/devbox/internal/devbox.(*Devbox).recomputeState go.jetpack.io/devbox/internal/devbox/packages.go:338 go.jetpack.io/devbox/internal/devbox.(*Devbox).ensureStateIsUpToDate go.jetpack.io/devbox/internal/devbox/packages.go:278 go.jetpack.io/devbox/internal/devbox.(*Devbox).ensureStateIsUpToDateAndComputeEnv go.jetpack.io/devbox/internal/devbox/devbox.go:1015 go.jetpack.io/devbox/internal/devbox.(*Devbox).Shell go.jetpack.io/devbox/internal/devbox/devbox.go:207 go.jetpack.io/devbox/internal/boxcli.runShellCmd go.jetpack.io/devbox/internal/boxcli/shell.go:83 go.jetpack.io/devbox/internal/boxcli.shellCmd.func1 go.jetpack.io/devbox/internal/boxcli/shell.go:36 github.com/spf13/cobra.(*Command).execute github.com/spf13/cobra@v1.8.0/command.go:983 github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra@v1.8.0/command.go:1115 github.com/spf13/cobra.(*Command).Execute github.com/spf13/cobra@v1.8.0/command.go:1039 go.jetpack.io/devbox/internal/boxcli/midcobra.(*midcobraExecutable).Execute go.jetpack.io/devbox/internal/boxcli/midcobra/midcobra.go:61 go.jetpack.io/devbox/internal/boxcli.Execute go.jetpack.io/devbox/internal/boxcli/root.go:113 go.jetpack.io/devbox/internal/boxcli.Main go.jetpack.io/devbox/internal/boxcli/root.go:136 main.main go.jetpack.io/devbox/cmd/devbox/main.go:11 runtime.main runtime/proc.go:271 runtime.goexit runtime/asm_amd64.s:1695 2024/06/12 12:28:06 findProjectDir: path is 2024/06/12 12:28:06 finding devbox config in dir: /home/vilsol/tmp/devbox-flake-bug
What happened?
I have defined a local flake that has impurities, so it must be built using the
--impure
flag.Running
nix shell --impure
works fine.I would expect that unless
--pure
is passed todevbox shell
it would build flakes as impure.It seems that the issue is a missing
--impure
here: https://github.com/jetify-com/devbox/blob/main/internal/nix/command.go#L31I would be willing to make a PR to add it if
--pure
is unspecified.Steps to reproduce
devbox shell
Command
shell
devbox.json
Devbox version
0.11.0
Nix version
nix (Nix) 2.18.2
What system does this bug occur on?
Linux (x86-64)
Debug logs