jetify-com / devbox

Instant, easy, and predictable development environments

Home Page:https://www.jetify.com/devbox/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

devbox update fail when git flake are present

kadaan opened this issue · comments

What happened?

Running devbox update fails when git flakes are present in the devbox.json.

Steps to reproduce

  1. Add git flake to devbox.json
  2. Run devbox shell
  3. Exit shell
  4. Run devbox update

Command

No response

devbox.json

{
  "packages": [
    "git+ssh://git@bitbucket.org/foo/bar.git#baz"
  ],
}

Devbox version

0.9.1

Nix version

2.19.3

What system does this bug occur on?

macOS (Apple Silicon)

Debug logs

2024/02/29 17:53:38 findProjectDir: path is
2024/02/29 17:53:38 finding devbox config in dir: /source/work/joelb_test
2024/02/29 17:53:38 findProjectDir: path is
2024/02/29 17:53:38 finding devbox config in dir: /source/work/joelb_test
2024/02/29 17:53:38 findProjectDir: path is
2024/02/29 17:53:38 finding devbox config in dir: /source/work/joelb_test
Error: git+ssh://git@bitbucket.org/foo/bar.git#baz: package not found

2024/02/29 17:53:39
ExecutionID:2323d1a6d79f4977814fa853ea181384
package not found
go.jetpack.io/devbox/internal/nix.init
:1
runtime.doInit1
/nix/store/2022s0jnrn2iyxjaikfy51w5fvifp38b-go-1.22.0/share/go/src/runtime/proc.go:7176
runtime.doInit
/nix/store/2022s0jnrn2iyxjaikfy51w5fvifp38b-go-1.22.0/share/go/src/runtime/proc.go:7143
runtime.main
/nix/store/2022s0jnrn2iyxjaikfy51w5fvifp38b-go-1.22.0/share/go/src/runtime/proc.go:253
runtime.goexit
/nix/store/2022s0jnrn2iyxjaikfy51w5fvifp38b-go-1.22.0/share/go/src/runtime/asm_arm64.s:1222
2024/02/29 17:53:39 findProjectDir: path is
2024/02/29 17:53:39 finding devbox config in dir: /source/work/joelb_test

There seem to be multiple problems here:

  1. func (f *File) FetchResolvedPackage(pkg string) (*Package, error) { fails skip flakes
  2. If devbox shell has not been run then devbox update will fail because the ./.devbox/gen/flake/flake.nix file is missing
  3. Devbox issues nix build calls with --impure, but nix flake update is not specified with --impure. That said, I don't know if the semantics of nix flake update will be the same as devbox update performing nix build --refresh ... for flakerefs

Might this be solved by:

  1. adding a new method like IsRunX called IsFlake and skipping flakes in FetchResolvedPackage
  2. pass installMode down from ensureStateIsUpToDate to installNixPackagesToStore and if installMode == update add --refresh to the command args