diff --git a/modules/services/window-managers/xmonad.nix b/modules/services/window-managers/xmonad.nix index e0c5019a7..feeba1a6c 100644 --- a/modules/services/window-managers/xmonad.nix +++ b/modules/services/window-managers/xmonad.nix @@ -19,6 +19,15 @@ let self.xmonad-extras ]; }; + ghc-builder = cfg.haskellPackages.ghcWithPackages ( + self: + [ self.xmonad ] + ++ (cfg.extraPackages self) + ++ lib.optionals cfg.enableContribAndExtras [ + self.xmonad-contrib + self.xmonad-extras + ] + ); in { @@ -104,6 +113,20 @@ in contents of the files. ''; }; + buildScript = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + Build script for your xmonad configuration. + ''; + }; + buildScriptPackages = mkOption { + type = types.listOf types.package; + default = [ ]; + description = '' + Extra packages needed to run the build script. + ''; + }; }; }; @@ -119,7 +142,11 @@ in xmonadBin = "${ pkgs.runCommandLocal "xmonad-compile" { - nativeBuildInputs = [ xmonad ]; + nativeBuildInputs = [ + xmonad + ghc-builder + ] + ++ cfg.buildScriptPackages; } '' mkdir -p $out/bin @@ -131,7 +158,9 @@ in mkdir -p "$XMONAD_CONFIG_DIR/lib" "$XMONAD_CACHE_DIR" "$XMONAD_DATA_DIR" cp ${cfg.config} xmonad-config/xmonad.hs - + ${lib.optionalString (cfg.buildScript != null) '' + cp ${cfg.buildScript} xmonad-config/build && chmod +x xmonad-config/build + ''} declare -A libFiles libFiles=(${ lib.concatStringsSep " " (lib.mapAttrsToList (name: value: "['${name}']='${value}'") cfg.libFiles)