You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[flakes] Assign higher priority to later packages to resolve conflicting packages error (#738)
## Summary
We want to re-try nix profile install with package conflicts by setting
a higher priority (lower priority number) for later packages.
## How was it tested?
using the github.com/jetpack-io/devbox-examples repo
before:
```
devbox-examples/development/ruby on main [!?] on ☁️ (us-east-2) on ☁️ [email protected] 💫 initial project sync
❯ devbox shell
Ensuring packages are installed.
Installing 2 packages: bundler, ruby_3_1.
[1/2] bundler
[1/2] bundler: Success
[2/2] ruby_3_1
error: files '/nix/store/spgr12gk13af8flz7akbs18fj4whqss2-bundler-2.4.5/bin/bundle' and '/nix/store/l4wmx8lfn6hlcfmbyhmksm024f8hixm1-ruby-3.1.2/bin/bundle' 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)
[2/2] ruby_3_1: Fail
Error: Command: /nix/var/nix/profiles/default/bin/nix profile install --profile /Users/savil/code/jetpack/devbox-examples/development/ruby/.devbox/nix/profile/default --impure nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#ruby_3_1 --extra-experimental-features ca-derivations --option experimental-features nix-command flakes --priority 5: exit status 1
Error: There was an internal error. Run with DEVBOX_DEBUG=1 for a detailed error message, and consider reporting it at https://github.com/jetpack-io/devbox/issues
```
Then I added `devbox global add zig` to test the sorting for global
packages first and then project packages later.
after:
```
❯ DEVBOX_DEBUG=0 devbox shell
Ensuring packages are installed.
Installing 3 packages: zig, bundler, ruby_3_1.
[1/3] zig
[1/3] zig: Success
[2/3] bundler
[2/3] bundler: Success
[3/3] ruby_3_1
[3/3] ruby_3_1: Success
Starting a devbox shell...
(devbox)
```
after with DEVBOX_DEBUG=1:
```
❯ DEVBOX_DEBUG=1 devbox shell
...
Installing 3 packages: zig, bundler, ruby_3_1.
[DEBUG] 2023/03/09 21:19:24 /Users/savil/code/jetpack/devbox/internal/impl/packages.go:246: ERROR: resetProfileDirForFlakes error: lstat /Users/savil/code/jetpack/devbox-examples/development/ruby/.devbox/nix/profile/default: no such file or directory
[1/3] zig
[1/3] zig: Success
[2/3] bundler
[2/3] bundler: Success
[3/3] ruby_3_1
[DEBUG] 2023/03/09 21:19:27 /Users/savil/code/jetpack/devbox/internal/nix/writer.go:39: Hiding output for user: error: files '/nix/store/spgr12gk13af8flz7akbs18fj4whqss2-bundler-2.4.5/bin/bundle' and '/nix/store/l4wmx8lfn6hlcfmbyhmksm024f8hixm1-ruby-3.1.2/bin/bundle' 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 how to change the priority of one of the conflicting packages (0 being the highest priority)
[DEBUG] 2023/03/09 21:19:27 /Users/savil/code/jetpack/devbox/internal/nix/profile.go:286: Re-trying nix profile install with priority 4 for package ruby_3_1
[3/3] ruby_3_1: Success
Starting a devbox shell...
```
0 commit comments