Skip to content

Conversation

savil
Copy link
Collaborator

@savil savil commented Jan 25, 2023

Summary

Problem:

  • Prior to [install UX] show incremental progress #491:
    • we'd install packages in the nix-profile using nix-env --install development.nix.
      This was subsequently changed to install each package individually as in nix-env --install --attr <package>.
    • the nix-profile would have the package under /nix/store/<hash>-devbox-development/path/to/binary
      which is now /nix/store/<hash>-<package>/path/to/binary.
  • So, nix will complain about this conflict in the nix-profile.

Fix #1:
A brute-force fix is to rm -rf .devbox directory but this is bad UX

This PR's Fix:
The fix for now is to always re-create the profile. This is not great but tolerable
since we are not currently using the profile's generations. (We rely on the nix-profile
to enable us to install the package upon devbox add so it is present right away and when the
user next does devbox shell).

How was it tested?

Step 1: built devbox from a commit prior to #491 to build the "old style" nix profile
Step 2: go to main and run devbox shell in the go-1.19 example project. This fails.
Step 3: go to this branch, and run devbox shell again. This works.

Copy link
Collaborator Author

savil commented Jan 25, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@savil savil requested a review from ipince January 25, 2023 05:45
@savil
Copy link
Collaborator Author

savil commented Jan 25, 2023

For underlying cause, posting raw output for posterity:

❯ devbox shell
Installing nix packages. This may take a while...
✓ [1/2] nixpkgs
✘ [2/2] go_1_19

Error: apply Nix derivation: error running command /nix/var/nix/profiles/default/bin/nix-env --profile /Users/savil/code/jetpack/devbox/examples/testdata/go/go-1.19/.devbox/nix/profile/default -f https://github.com/nixos/nixpkgs/archive/52e3e80afff4b16ccb7c52e9f0f5220552f03d04.tar.gz --install --attr go_1_19: exit status 1

I then run the nix-env --install command printed above:

testdata/go/go-1.19 on  main [$] via 🐹 v1.19.2 on ☁️  (us-east-2) on ☁️  savil.srivastava@jetpack.io 💫 watching
❯ nix-env --profile /Users/savil/code/jetpack/devbox/examples/testdata/go/go-1.19/.devbox/nix/profile/default -f https://github.com/nixos/nixpkgs/archive/52e3e80afff4b16ccb7c52e9f0f5220552f03d04.tar.gz --install --attr go_1_19
installing 'go-1.19.3'
building '/nix/store/rparx874qnyisdm73vw60zk23sm75pyz-user-environment.drv'...
error: files '/nix/store/w0lyimyyxxfl3gw40n46rpn1yjrl3q85-go-1.19.3/bin/go' and '/nix/store/v4qfigkkamxw9qnw94jv1vbwrjiqqym5-devbox-development/bin/go' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' or type 'nix profile install --help' if using 'nix profile' to find out howto change the priority of one of the conflicting packages (0 being the highest priority)
error: builder for '/nix/store/rparx874qnyisdm73vw60zk23sm75pyz-user-environment.drv' failed with exit code 1;
       last 1 log lines:
       > error: files '/nix/store/w0lyimyyxxfl3gw40n46rpn1yjrl3q85-go-1.19.3/bin/go' and '/nix/store/v4qfigkkamxw9qnw94jv1vbwrjiqqym5-devbox-development/bin/go' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' or type 'nix profile install --help' if using 'nix profile' to find out howto change the priority of one of the conflicting packages (0 being the highest priority)
       For full logs, run 'nix log /nix/store/rparx874qnyisdm73vw60zk23sm75pyz-user-environment.drv'.

@savil savil requested a review from loreto January 25, 2023 05:51
@ipince
Copy link
Contributor

ipince commented Jan 25, 2023

To be clear, we only need to do this during some "transition time", right? Once we can expect most users to have upgraded their devbox (within reason), then we can stop deleting the profile every time.

@savil
Copy link
Collaborator Author

savil commented Jan 25, 2023

To be clear, we only need to do this during some "transition time", right? Once we can expect most users to have upgraded their devbox (within reason), then we can stop deleting the profile every time.

Yes, I would expect so...

@savil
Copy link
Collaborator Author

savil commented Jan 25, 2023

see #512 for an alternative approach to fixing this.

@savil
Copy link
Collaborator Author

savil commented Jan 25, 2023

closing in favor of #513

@savil savil closed this Jan 25, 2023
savil added a commit that referenced this pull request Jan 25, 2023
## Summary

With the recent install-UX improvement of #491, we may run into issues
for
existing users. #508 summarizes the issue and has a workaround fix
implemented.
However, it had me thinking whether this is introducing more risk than
we want
for this week.

To summarize, the improvements made in #491 and later in #506 are:
1. #491: use stepper. Install each package individually, instead of
using `development.nix`.
2. #506: stream the output of `nix-env --install`.

This PR makes it so we continue doing #506 to preserve some UX
improvement, but revert #491 to minimize risk.

When I try it in `devbox cloud shell` with `bazel` and `buf`, the
streaming output helps
preserve the feeling of progress being made. The viewer is no longer
left pondering
"is it stuck? is it broken?".

## How was it tested?

- built a linux devbox binary and deployed a custom VM
- did `devbox cloud shell` to that VM:

The following output shows but is printed in a streaming fashion as
opposed
to blank for a long time and then shows up in one-go.
```
Devbox Cloud
Remote development environments powered by Nix

✓ File syncing started
→ Connecting to virtual machine


Installing nix packages. This may take a while...
	installing 'devbox-development'
	these 2 derivations will be built:
	  /nix/store/9yk55y5ywvm4ihnllfa2kcz158bmbfbg-builder.pl.drv
	  /nix/store/xwcvqhd7fd49dndn5wvn2hx2vcxlrkp0-devbox-development.drv
	these 59 paths will be fetched (919.80 MiB download, 1815.57 MiB unpacked):
	  /nix/store/039g378vc3pc3dvi9dzdlrd0i4q93qwf-binutils-2.39
	  /nix/store/0zmylwn0sznzflf137hhqlnnyskr6cdk-openjdk-headless-11.0.15+10
	  /nix/store/1d6ian3r8kdzspw8hacjhl3xkp40g1lj-binutils-wrapper-2.39
	  /nix/store/1dgws25664p544znpc6f1nh9xmjf4ykc-pcre-8.45
	  /nix/store/1gf2flfqnpqbr1b4p4qz2f72y42bs56r-gcc-11.3.0
	  /nix/store/1i5ah27gxx3a3fyjyydfwwzqq8ni33i8-ncurses-6.3-p20220507

    ... // omitted

    /nix/store/y6aj732zm9m87c82fpvf103a1xb22blp-file-5.43
    /nix/store/zdba9frlxj2ba8ca095win3nphsiiqhb-python3-3.10.8
    /nix/store/zlcnmqq14jz5x9439jf937mvayyl63da-xz-5.2.7-bin
  copying path '/nix/store/hlqzdmnprp3cqwmj4zpzllb8aarjkbvb-iana-etc-20220915' from 'https://cache.nixos.org'...
  copying path '/nix/store/2js892db4aspqb06b9hlxmcr0g97gf3z-bazel-deps' from 'https://cache.nixos.org'...
  copying path '/nix/store/039g378vc3pc3dvi9dzdlrd0i4q93qwf-binutils-2.39' from 'https://cache.nixos.org'...
  copying path '/nix/store/a8mhcagrsly7c7mpjrpsnaahk4aax056-bzip2-1.0.8-bin' from 'https://cache.nixos.org'...
  copying path '/nix/store/xwl6y60ffijfbhxb754dlxk3pkjgw0d2-ed-1.18' from 'https://cache.nixos.org'...
  copying path '/nix/store/a1ad8qiqqb9fpg5a9rhlkm44s02sr61p-expand-response-params' from 'https://cache.nixos.org'...
    
    ... // omitted
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants