devbox
devbox copied to clipboard
Improve integration between devbox and desktop environments
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
.
- GUI applications don't show up in the list of applications to launch from the pop os launcher
- I installed neovim 0.10.1, which has a .desktop file, but it didn't show up in the launcher
- This was because
~/.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
?
- After fixing 1, the GUI applications now appear in the launcher but clicking on them does nothing
- This was because
~/.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.
- This was because
- systemctl can't find unit files
-
After installing syncthing 1.27.12, I was able to run it directly from a terminal, but systemctl couldn't find the unit file
-
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):[Manager] # Don't do this ManagerEnvironment="XDG_DATA_DIRS=/home/andrew/.local/share/devbox/global/default/.devbox/nix/profile/default/share/"
-
After adding the above,
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) -
Instead, you can
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.
-
- Apps that use OpenGL don't work
- I installed wezterm 20240203-110809-5046fc22, but when trying to run it, I ran into libEGL errors. This appears to be a common problem with nix applications that use OpenGL. I saw https://github.com/nix-community/nixGL but I haven't yet looked into how to integrate that in with devbox. At the very least, I know I can't install it with devbox with a simple
devbox global add nixGL
.
- I installed wezterm 20240203-110809-5046fc22, but when trying to run it, I ran into libEGL errors. This appears to be a common problem with nix applications that use OpenGL. I saw https://github.com/nix-community/nixGL but I haven't yet looked into how to integrate that in with devbox. At the very least, I know I can't install it with devbox with a simple
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