Skip to content

Conversation

rbelem
Copy link

@rbelem rbelem commented May 28, 2023

Summary

How was it tested?

@rbelem rbelem marked this pull request as draft May 28, 2023 00:03
@bketelsen
Copy link
Contributor

This is useful! While you're here, can you add DEVBOX_GLOBAL_ROOT pointing to .local/share/devbox/global/current. That's useful to find files that are needed in the global profile, since the global profile is usually not executed in the same directory where the global devbox.json file lives.

@Lagoja Lagoja requested a review from mikeland73 May 31, 2023 18:40
@mikeland73
Copy link
Contributor

@rbelem are you mostly interested in the global root? (the one @bketelsen mentioned) As implemented in this PR it will export for all devbox projects so we may need to special case global or use a different predictable env var for each.

Can you share a bit more about your use case? Do you need the nix profile specifically? Or binaries that have been installed by devbox (.devbox/virtenv/.wrappers/bin/ may be a better path for that, we use wrappers to ensure nix setup hooks are called correctly).

@rbelem
Copy link
Author

rbelem commented May 31, 2023

@mikeland86, I think this is needed for projects and global. I saw myself making an env var for both.
One of my first iterations in the devbox channel was about creating an env var DEVBOX_PREFIX to build the path to a script that was in the share dir. And now DEVBOX_GLOBAL_PREFIX for my global 😅

@mikeland73
Copy link
Contributor

@rbelem thoughts on a new command:

devbox path
devbox path -c path/to/my/config
devbox global path
devbox path --nix-profile
devbox path --bins

So you could do

DEVBOX_GLOBAL_NIX_PROFILE="$(devbox global path --nix-profile)"

cc: @Lagoja

@rbelem
Copy link
Author

rbelem commented May 31, 2023

@mikeland86 Looks flawless to me! And how would the ROOT path that @bketelsen mentioned work? devbox path --projectDir or devbox path --root?

@mikeland73
Copy link
Contributor

@rbelem I was thinking making devbox path (and devbox global path) point to the root.

@bketelsen
Copy link
Contributor

bketelsen commented May 31, 2023 via email

@rbelem
Copy link
Author

rbelem commented May 31, 2023

@mikeland86 and devbox global path --nix-profile would point to $HOME/.local/share/devbox/global/default/.devbox/nix/profile/default? devbox global path to $HOME/.local/share/devbox/global/default?

@mikeland73
Copy link
Contributor

@rbelem yep I think so. Open to suggestions if you have a strong opinion.

Main point of contention is deciding if this merits a new top level command. But we're on board with adding the functionality.

@rbelem
Copy link
Author

rbelem commented Jun 1, 2023

@mikeland86 Look good to me :D ty \o/

mikeland73 added a commit that referenced this pull request Jun 1, 2023
## Summary

Inspired by #1058

## How was it tested?

```bash
➜  devbox git:(landau/global-path) devbox global path
/Users/mike/.local/share/devbox/global/default
```
@rbelem rbelem closed this Jun 1, 2023
@rbelem rbelem deleted the devbox-global-prefix branch June 1, 2023 18:50
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.

3 participants