Skip to content

Nix shell is spawned on every command #6578

@igor-sirotin

Description

@igor-sirotin

Description

foo:
	echo 1
	echo 2

And when I run this from usual terminal:

> make foo
echo 1
Configuring Nix shell for target 'default'...
1
echo 2
Configuring Nix shell for target 'default'...
2

Obviously, it's not like that when I run it from make shell:

> make shell
[nix] > make foo
echo 1
1
echo 2
2

Because it was fixed here:

What's the issue?

  1. Since we automatically spawn nix-shell on every Makefile target, as a developer I would assume that it should work, and make shell is not a required prerequisite.
    But this doesn't happen. And spawning a nix-shell on each has 2 drawbacks:

    • Time consuming (4 second on each command)
    • The target command continues to execute even after an error:
    foo:
        echo 1; \
        go foo; \
        echo 3
    > make foo
    Configuring Nix shell for target 'default'...
    1
    go foo: unknown command
    Run 'go help' for usage.
    3
  2. CI doesn't do make shell
    Looking at any last successful CI build, we can see that Nix shell is started a few times. And we can see that gomobile init fails, but gomobile bind is still executed

[2025-05-14T13:45:16.816Z] �[0;32mConfiguring Nix shell for target 'default'...�[0m
[2025-05-14T13:45:19.009Z] Building status-go for iOS...
[2025-05-14T13:45:19.009Z] export GO111MODULE=off; \
[2025-05-14T13:45:19.009Z] gomobile init; \
[2025-05-14T13:45:19.009Z] gomobile bind -v \
[2025-05-14T13:45:19.009Z] 	-target=ios -ldflags="-s -w" \
[2025-05-14T13:45:19.009Z] 	-tags 'nowatchdog gowaku_no_rln disable_torrent' \
[2025-05-14T13:45:19.009Z] 	 \
[2025-05-14T13:45:19.009Z] 	-o build/bin/Statusgo.xcframework \
[2025-05-14T13:45:19.009Z] 	github.com/status-im/status-go/mobile
[2025-05-14T13:45:19.009Z] �[0;32mConfiguring Nix shell for target 'default'...�[0m
[2025-05-14T13:45:22.763Z] /nix/store/i6wd00maj94ah6bsyasdd21dxircxsjs-gomobile-0-unstable-2024-12-13/bin/gomobile: go install golang.org/x/mobile/cmd/gobind failed: exit status 1
[2025-05-14T13:45:22.763Z] /nix/store/i6wd00maj94ah6bsyasdd21dxircxsjs-gomobile-0-unstable-2024-12-13/src/golang.org/x/mobile/internal/importers/ast.go:39:2: cannot find package "golang.org/x/tools/go/packages" in any of:
[2025-05-14T13:45:22.763Z] 	/nix/store/i04a1a6qgxhjw6c0ld2b3x1v815sbxjc-go-1.22.3/share/go/src/golang.org/x/tools/go/packages (from $GOROOT)
[2025-05-14T13:45:22.763Z] 	/Users/jenkins/workspace/status-go_prs_ios_PR-6519@tmp/go/src/golang.org/x/tools/go/packages (from $GOPATH)
[2025-05-14T13:45:22.763Z] 	/nix/store/i6wd00maj94ah6bsyasdd21dxircxsjs-gomobile-0-unstable-2024-12-13/src/golang.org/x/tools/go/packages
[2025-05-14T13:45:22.763Z] 
[2025-05-14T13:45:58.533Z] internal/godebugs
[2025-05-14T13:45:58.533Z] internal/goexperiment
[2025-05-14T13:45:58.533Z] internal/goarch
[2025-05-14T13:45:58.533Z] internal/itoa
[2025-05-14T13:45:58.533Z] internal/goos
[2025-05-14T13:45:58.533Z] internal/unsafeheader
[2025-05-14T13:45:58.533Z] internal/godebugs
[2025-05-14T13:45:58.533Z] internal/goexperiment
[2025-05-14T13:45:58.533Z] internal/goos
[2025-05-14T13:45:58.533Z] internal/cpu
[2025-05-14T13:45:58.533Z] internal/itoa
[2025-05-14T13:45:58.533Z] math/bits
... `gomobile bind` continues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions