diff options
author | Robert Helgesson <robert@rycee.net> | 2017-10-31 14:05:54 +0100 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2017-10-31 14:05:54 +0100 |
commit | 78a14245821060f633057e731906ffacf7e5b7e0 (patch) | |
tree | 63b4096f8e450048c19191c32a214aa563795f5a /modules/services/window-managers/xmonad.nix | |
parent | 82d6aa0c97220b1398cd46824fa61c7c2a09dd18 (diff) |
xsession: remove `xsession.windowManager` option
This removes the deprecated use of `xsession.windowManager` as a
string.
This commit also adjusts the xmonad module to become a full module.
I.e., the backwards compatibility hack was removed.
Diffstat (limited to 'modules/services/window-managers/xmonad.nix')
-rw-r--r-- | modules/services/window-managers/xmonad.nix | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/modules/services/window-managers/xmonad.nix b/modules/services/window-managers/xmonad.nix index 8105612c8c6..d512cde076a 100644 --- a/modules/services/window-managers/xmonad.nix +++ b/modules/services/window-managers/xmonad.nix @@ -1,10 +1,11 @@ -{ pkgs }: { config, lib, ... }: +{ config, lib, pkgs, ... }: with lib; +with import ../../lib/dag.nix { inherit lib; }; let - cfg = config.xmonad; + cfg = config.xsession.windowManager.xmonad; xmonad = pkgs.xmonad-with-packages.override { ghcWithPackages = cfg.haskellPackages.ghcWithPackages; @@ -19,7 +20,7 @@ in { options = { - xmonad = { + xsession.windowManager.xmonad = { enable = mkEnableOption "xmonad window manager"; haskellPackages = mkOption { @@ -80,7 +81,32 @@ in }; }; - config = mkIf cfg.enable { - command = "${xmonad}/bin/xmonad"; - }; + config = mkIf cfg.enable (mkMerge [ + { + xsession.windowManager.command = "${xmonad}/bin/xmonad"; + } + + (mkIf (cfg.config != null) { + home.file.".xmonad/xmonad.hs".source = cfg.config; + + home.activation.checkXmonad = dagEntryBefore [ "linkGeneration" ] '' + if ! cmp --quiet "${cfg.config}" "$HOME/.xmonad/xmonad.hs"; then + xmonadChanged=1 + fi + ''; + + home.activation.applyXmonad = dagEntryAfter [ "linkGeneration" ] '' + if [[ -v xmonadChanged ]]; then + echo "Recompiling xmonad" + ${config.xsession.windowManager.command} --recompile + + # Attempt to restart xmonad if X is running. + if [[ -v DISPLAY ]] ; then + echo "Restarting xmonad" + ${config.xsession.windowManager.command} --restart + fi + fi + ''; + }) + ]); } |