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?


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} &

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.