XFCE on Debian + home-manager


I am trying to setup my usual environment on a Debian 10 system, with home-manager. Everything works correctly, except that the XFCE environment is not setup correctly:

  • the icons for emacs and firefox don’t appear in the menu
  • when I try to start something that I installed with home-manager via XFCE with Alt+F2, it says “program not found”

I guess this has to do with the XDG_DATA_DIRS variable but I’m not sure how to fix it.

XFCE is started with:

/bin/sh /etc/xdg/xfce4/xinitrc -- /etc/X11/xinit/xserverrc

I tried adding:

export XDG_DATA_DIRS="$HOME/.nix-profiles/share:XDG_DATA_DIRS

to /etc/xdg/xfce4/xinitrc but afterwards XFCE would not start.

In home-manager I have set

target.genericLinux.enable = true;
xdg.enable = true;
xdg.mime.enable = true;

Oh it looks like I could actually have home-manager manage XFCE instead, of using Debian’s package: Letting home-manager handle the X session on Debian

But I don’t really understand how things interact between ~/.xinitrc, ~/.xserverrc, ~/.xsession, ~/.xsessionrc (!), ~/.profile and ~/.xprofile and the DM. Why are there so many different configuration files?

XFCE is not listed in home-manager’s options so I’m not sure how far you can go.

I don’t understand everything either but I can try to explain my setup that works on Fedora with the i3 window manager. You will probably have to adapt things.

  1. I have no ~/.xinitrc, no ~/.xserverrc, and no ~/.xsessionrc
  2. Home-manager generates my ~/.profile, ~/.xprofile, ~/.xsession, ~/.bashrc, ~/.bash_profile and ~/.pam_environment files
  3. Install the Debian/Fedora package lightdm: this is the GUI that will let you select a session (e.g., gnome, xfce, or xinit)
  4. You might need to remove other display managers to have lightdm take control (e.g., gdm)
  5. Configure genericLinux with your system XDG data directories:
    targets.genericLinux = {
        enable = true;
        extraXdgDataDirs = [ "/usr/share" "/usr/local/share" ];
  6. Enable home-manager programs.home-manager.entable = true;
  7. You might want to enable the gnome-keyring too: services.gnome-keyring.enable = true;
  8. Let home-manager generate an xsession:
    xdg.enable = true;
    xsession.enable = true;
    fonts.fontconfig.enable = true;
  9. You might want to enable bash support programs.bash.enable = true;
  10. Enable i3: xsession.windowManager.i3.enable = true;

Then, you can switch to the configuration, verify home-manager generated a bunch of configuration files in your home directory and reboot your computer. When lightdm appears, select the “Default Xsession” session from the menu in the top bar.

You may contact me on IRC (freenode) or Matrix (matrix.org) if you have questions. My username is DamienCassou in both.


Thanks a lot @DamienCassou :slight_smile:
I got your i3 config running on the first attempt with your instructions, so I’ll just roll with that for the moment. Maybe I’ll get use to it. Otherwise, I’ll dig a bit more into XFCE this week-end.