Open andbleo opened 2 months ago
Point 2 can be fixed by prepending the Exec
line with devbox global run
.
I worked around this issue by creating a $HOME/.local/bin/devbox
script like this:
#!/bin/env bash
/usr/local/bin/devbox "$@"
for i in "$HOME"/.local/share/devbox/global/default/.devbox/nix/profile/default/share/applications/*.desktop; do
sed "s/Exec=/Exec=devbox global run /" "$i" >"$HOME"/.local/share/applications/"$(basename "$i")"
done
for i in "$HOME"/.local/share/applications/*.desktop; do
# take the first word of the Exec= line
exec="$(grep -oP '^Exec=\K[^ ]+' "$i")"
# check if the first word doesnt exists as a command in the path
for exec in $exec; do
if ! command -v "$exec" &>/dev/null; then
echo "$i should be removed because $exec doesn't exists"
fi
done
done
I switched to zsh, but I ended up running eval "$(devbox global shellenv)"
in both .profile and .zshrc. This appears to have worked ok so far.
What problem are you trying to solve?
devbox advertises itself as a replacement for apt or brew for global package management (https://www.jetify.com/devbox/docs/devbox_global/), but the current support for GUI applications and systemd services is lacking and can give a poor first impression for people coming from other package managers. Here are some issues I ran into as a first time user on a fresh install of Pop!_OS 22.04 LTS with devbox 0.12.0 and the Determinate nix installer 0.25.0. Everything done below was in
devbox global
.~/.local/share/devbox/global/default/.devbox/nix/profile/default/share/
was not added toXDG_DATA_DIRS
. I added this myself in my~/.profile
, and after a reboot, I could see the applications. I don't know if this is the correct or ideal solution for this though. If it is, perhapseval "$(devbox global shellenv)"
could also updateXDG_DATA_DIRS
?~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin
was not in thePATH
for the Gnome shell. I saw thateval "$(devbox global shellenv)"
was adding the devbox global bin path toPATH
, but the recommendation was to put that into.bashrc
, which Gnome shell doesn't use. When I movedeval "$(devbox global shellenv)"
to my.profile
and rebooted, I was able to run the GUI applications from the launcher. Unfortunately, this meant that therefresh-global
alias was not available in my terminal, so I have a feeling this is not a good solution.systemctl can't find unit files
After much trial and error and googling, I found that you can inject the path to devbox's share directory into the
XDG_DATA_DIRS
env var thatsystemctl -- user
uses by adding the following to~/.config/systemd/user.conf
(but it will break non-nix systemd user services):systemctl --user status syncthing.service
was able to find the unit file and I could start the service, but this broke other user services (namely, my sound no longer worked, which needed pipewire)systemctl --user --now enable <full_path_to_nix_systemd_unit_file>
and avoid the entire problem. Annoying not to be able to refer to unit file by its relative name only, but better than breaking everything else.devbox global add nixGL
.These are the issues I have encountered trying to run 3 different apps that I installed, so it likely isn't an exhaustive list.
What solution would you like?
If there aren't quick fixes to the problems I outlined above, it would be great to see some updated docs/FAQs explaining the current limitations of devbox as a global package manager and/or some workarounds until the out of the box experience is better. I think devbox has a lot to offer, but I would hate to see people turned away from it immediately if the app they want to use doesn't run correctly.
Alternatives you've considered
Some of these issues I ran into are detailed in a bug here: https://github.com/jetify-com/devbox/issues/2227