2014-05-05 20:58:51 +02:00
|
|
|
{pkgs, lib, config, ...}:
|
2009-01-25 16:49:08 +01:00
|
|
|
|
|
|
|
let
|
2014-05-05 20:58:51 +02:00
|
|
|
inherit (lib) mkOption mkIf optionals literalExample;
|
2009-01-25 16:49:08 +01:00
|
|
|
cfg = config.services.xserver.windowManager.xmonad;
|
2013-12-12 22:33:51 +01:00
|
|
|
xmonadEnv = cfg.haskellPackages.ghcWithPackages(self: [
|
|
|
|
self.xmonad
|
|
|
|
] ++ optionals cfg.enableContribAndExtras [ self.xmonadContrib self.xmonadExtras]
|
|
|
|
++ optionals (cfg.extraPackages != null) (cfg.extraPackages self));
|
|
|
|
xmessage = pkgs.xlibs.xmessage;
|
2009-01-25 16:49:08 +01:00
|
|
|
in
|
|
|
|
{
|
2009-09-15 10:33:45 +02:00
|
|
|
options = {
|
|
|
|
services.xserver.windowManager.xmonad = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "Enable the xmonad window manager.";
|
2009-01-25 16:49:08 +01:00
|
|
|
};
|
2013-12-12 22:33:51 +01:00
|
|
|
|
|
|
|
haskellPackages = mkOption {
|
|
|
|
default = pkgs.haskellPackages;
|
|
|
|
defaultText = "pkgs.haskellPackages";
|
|
|
|
example = literalExample "pkgs.haskellPackages_ghc701";
|
|
|
|
description = ''
|
|
|
|
haskellPackages used to build Xmonad and other packages.
|
|
|
|
This can be used to change the GHC version used to build
|
|
|
|
Xmonad and the packages listed in
|
|
|
|
<varname>extraPackages</varname>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
extraPackages = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = literalExample ''
|
|
|
|
haskellPackages: [
|
|
|
|
haskellPackages.xmonadContrib
|
|
|
|
haskellPackages.monadLogger
|
|
|
|
]
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
Extra packages available to ghc when rebuilding Xmonad. The
|
|
|
|
value must be a function which receives the attrset defined
|
|
|
|
in <varname>haskellpackages</varname> as the sole argument.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
enableContribAndExtras = mkOption {
|
|
|
|
default = false;
|
|
|
|
example = true;
|
2014-05-05 20:58:51 +02:00
|
|
|
type = lib.types.bool;
|
2013-12-12 22:33:51 +01:00
|
|
|
description = "Enable xmonad-{contrib,extras} in Xmonad.";
|
|
|
|
};
|
2009-09-15 10:33:45 +02:00
|
|
|
};
|
|
|
|
};
|
2013-12-12 22:33:51 +01:00
|
|
|
config = mkIf cfg.enable {
|
2009-09-15 10:33:45 +02:00
|
|
|
services.xserver.windowManager = {
|
2013-12-12 22:33:51 +01:00
|
|
|
session = [{
|
2009-09-15 10:33:45 +02:00
|
|
|
name = "xmonad";
|
2013-12-12 22:33:51 +01:00
|
|
|
start = ''
|
|
|
|
XMONAD_GHC=${xmonadEnv}/bin/ghc XMONAD_XMESSAGE=${xmessage}/bin/xmessage xmonad &
|
2009-09-15 10:33:45 +02:00
|
|
|
waitPID=$!
|
2013-12-12 22:33:51 +01:00
|
|
|
'';
|
2009-09-15 10:33:45 +02:00
|
|
|
}];
|
2009-01-25 16:49:08 +01:00
|
|
|
};
|
2013-12-12 22:33:51 +01:00
|
|
|
|
|
|
|
environment.systemPackages = [ cfg.haskellPackages.xmonad ];
|
2009-01-25 16:49:08 +01:00
|
|
|
};
|
|
|
|
}
|