@@ -10,6 +10,14 @@ let
1010 optionals cfg.enableContribAndExtras
1111 [ self.xmonad-contrib self.xmonad-extras ];
1212 };
13+ xmonadBin = pkgs.writers.writeHaskell "xmonad" {
14+ ghc = cfg.haskellPackages.ghc;
15+ libraries = [ cfg.haskellPackages.xmonad ] ++
16+ cfg.extraPackages cfg.haskellPackages ++
17+ optionals cfg.enableContribAndExtras
18+ (with cfg.haskellPackages; [ xmonad-contrib xmonad-extras ]);
19+ } cfg.config;
20+
1321in
1422{
1523 options = {
@@ -48,13 +56,36 @@ in
4856 type = lib.types.bool;
4957 description = "Enable xmonad-{contrib,extras} in Xmonad.";
5058 };
59+
60+ config = mkOption {
61+ default = null;
62+ type = with lib.types; nullOr (either path string);
63+ description = ''
64+ Configuration from which XMonad gets compiled. If no value
65+ is specified, the xmonad config from $HOME/.xmonad is taken.
66+ If you use xmonad --recompile, $HOME/.xmonad will be taken as
67+ the configuration, but on the next restart of display-manager
68+ this config will be reapplied.
69+ '';
70+ example = ''
71+ import XMonad
72+
73+ main = launch defaultConfig
74+ { modMask = mod4Mask -- Use Super instead of Alt
75+ , terminal = "urxvt"
76+ }
77+ '';
78+ };
5179 };
5280 };
5381 config = mkIf cfg.enable {
5482 services.xserver.windowManager = {
5583 session = [{
5684 name = "xmonad";
57− start = ''
85+ start = if (cfg.config != null) then ''
86+ ${xmonadBin}
87+ waitPID=$!
88+ '' else ''
5889 ${xmonad}/bin/xmonad &
5990 waitPID=$!
6091 '';