2014-05-05 20:58:51 +02:00
|
|
|
{pkgs, lib, config, ...}:
|
2009-01-25 16:49:08 +01:00
|
|
|
|
2015-12-04 15:32:21 +01:00
|
|
|
with lib;
|
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;
|
2015-02-02 23:05:23 +01:00
|
|
|
xmonad = pkgs.xmonad-with-packages.override {
|
|
|
|
ghcWithPackages = cfg.haskellPackages.ghcWithPackages;
|
|
|
|
packages = self: cfg.extraPackages self ++
|
|
|
|
optionals cfg.enableContribAndExtras
|
|
|
|
[ self.xmonad-contrib self.xmonad-extras ];
|
|
|
|
};
|
2009-01-25 16:49:08 +01:00
|
|
|
in
|
|
|
|
{
|
2009-09-15 10:33:45 +02:00
|
|
|
options = {
|
|
|
|
services.xserver.windowManager.xmonad = {
|
2015-12-04 10:38:23 +01:00
|
|
|
enable = mkEnableOption "xmonad";
|
2013-12-12 22:33:51 +01:00
|
|
|
haskellPackages = mkOption {
|
2015-11-13 19:11:46 +01:00
|
|
|
default = pkgs.haskellPackages;
|
|
|
|
defaultText = "pkgs.haskellPackages";
|
|
|
|
example = literalExample "pkgs.haskell.packages.ghc784";
|
2013-12-12 22:33:51 +01:00
|
|
|
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 {
|
2015-02-02 23:05:23 +01:00
|
|
|
default = self: [];
|
2017-08-08 01:14:58 +02:00
|
|
|
defaultText = "self: []";
|
2013-12-12 22:33:51 +01:00
|
|
|
example = literalExample ''
|
|
|
|
haskellPackages: [
|
2015-02-02 23:05:23 +01:00
|
|
|
haskellPackages.xmonad-contrib
|
|
|
|
haskellPackages.monad-logger
|
2013-12-12 22:33:51 +01:00
|
|
|
]
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
Extra packages available to ghc when rebuilding Xmonad. The
|
|
|
|
value must be a function which receives the attrset defined
|
2015-02-02 23:05:23 +01:00
|
|
|
in <varname>haskellPackages</varname> as the sole argument.
|
2013-12-12 22:33:51 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
enableContribAndExtras = mkOption {
|
|
|
|
default = false;
|
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 = ''
|
2015-02-02 23:05:23 +01:00
|
|
|
${xmonad}/bin/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
|
|
|
|
2015-02-02 23:05:23 +01:00
|
|
|
environment.systemPackages = [ xmonad ];
|
2009-01-25 16:49:08 +01:00
|
|
|
};
|
|
|
|
}
|