From c54beb953d00f576ba73565d0476af241af26013 Mon Sep 17 00:00:00 2001 From: Kurt Robert Rudolph Date: Mon, 10 Aug 2020 18:30:29 -0700 Subject: [PATCH] nixos/xmonad: Fix behavior of config opt Prior to this change, the `config` option (which allows you define the haskell configuration for xmonad in your configuration.nix instead of needing something in the home directory) prevents desktop manager resources from starting. This can be demonstrated by configuring the following: ``` services.xserver = { displayManager.defaultSession = "xfce+xmonad"; displayManager.lightdm.enable = true; desktopManager.xterm.enable = false; desktopManager.xfce.enable = true; desktopManager.xfce.enableXfwm = false; desktopManager.xfce.noDesktop = true; windowManager.xmonad = { enable = true; enableContribAndExtras = true; extraPackages = haskellPackages: [ haskellPackages.xmonad-contrib haskellPackages.xmonad-extras haskellPackages.xmonad ]; config = '' import XMonad import XMonad.Config.Xfce main = xmonad xfceConfig { terminal = "terminator" , modMask = mod4Mask } ''; }; }; ``` and after user log in, search for xfce processes `ps aux | grep xfce`. You will not find xfce processes running until after the xmonad process is killed. The bug prevents utilities included with the desktopManager, (e.g. powerManagement, session logout, etc.) from working as expected. --- nixos/modules/services/x11/window-managers/xmonad.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/x11/window-managers/xmonad.nix b/nixos/modules/services/x11/window-managers/xmonad.nix index 30c59b88f82f..070758720fe3 100644 --- a/nixos/modules/services/x11/window-managers/xmonad.nix +++ b/nixos/modules/services/x11/window-managers/xmonad.nix @@ -82,12 +82,11 @@ in services.xserver.windowManager = { session = [{ name = "xmonad"; - start = if (cfg.config != null) then '' - ${xmonadBin} - waitPID=$! - '' else '' - systemd-cat -t xmonad ${xmonad}/bin/xmonad & - waitPID=$! + start = let + xmonadCommand = if (cfg.config != null) then xmonadBin else "${xmonad}/bin/xmonad"; + in '' + systemd-cat -t xmonad ${xmonadCommand} & + waitPID=$! ''; }]; };