In NixOS, services.xserver.desktopManager.xfce.extraSessionCommands describes "Shell commands executed just before XFCE is started.". What about for shell commands right after XFCE is started?

That is, I want to persist in my configuration.nix file what I would normally put in an .xinitrc. Is this possible?

1 Answer 1


You should be able to put most of the application you would usually put into xinitrc also into services.xserver.desktopManager.xfce.extraSessionCommands as important environment variables such as $DISPLAY and $DBUS_SESSION_BUS_ADDRESS are set. In fact in most xinitrc's start the window manager as the last process.

Here is a snippet how extraSessionCommands is implemented taken from xfce.nix:

services.xserver.desktopManager.session = [{
  name = "xfce";
  bgSupport = true;
  start = ''
    # Set GTK_PATH so that GTK+ can find the theme engines.
    export GTK_PATH="${config.system.path}/lib/gtk-2.0:${config.system.path}/lib/gtk-3.0"
    # Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes.
    export GTK_DATA_PREFIX=${config.system.path}
    ${pkgs.runtimeShell} ${pkgs.xfce.xinitrc} &

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .