5890215501
PR #1366 The previous windowManager.xmonad option only starts xmonad and doesn't make ghc available. This assumes that the user has GHC with access to the xmonad package in his PATH when using xmonad. Xmonad in Nix is now patched to accept the XMONAD_{GHC,XMESSAGE} environment variables which define the path to either ghc or xmessage. These are set automatically when using xmonad through windowManager.xmonad. My (or specific: @aristidb and my) changes make it possible to use Xmonad without adding GHC to any profile. This is useful if you want to add a different GHC to your profile. This commit introduces some options: - xmonad.haskellPackages: Controls which Haskell package set & GHC set is used to (re)build Xmonad - xmonad.extraPackages: Function returning a list of additional packages to make available to GHC when rebuilding Xmonad - xmonad.enableContribExtras: Boolean option to build xmonadContrib and xmonadExtras. Signed-off-by: Moritz Ulrich <moritz@tarn-vedra.de>
70 lines
2.1 KiB
Nix
70 lines
2.1 KiB
Nix
{pkgs, config, ...}:
|
|
|
|
let
|
|
inherit (pkgs.lib) mkOption mkIf optionals literalExample;
|
|
cfg = config.services.xserver.windowManager.xmonad;
|
|
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;
|
|
in
|
|
{
|
|
options = {
|
|
services.xserver.windowManager.xmonad = {
|
|
enable = mkOption {
|
|
default = false;
|
|
example = true;
|
|
description = "Enable the xmonad window manager.";
|
|
};
|
|
|
|
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;
|
|
type = pkgs.lib.types.bool;
|
|
description = "Enable xmonad-{contrib,extras} in Xmonad.";
|
|
};
|
|
};
|
|
};
|
|
config = mkIf cfg.enable {
|
|
services.xserver.windowManager = {
|
|
session = [{
|
|
name = "xmonad";
|
|
start = ''
|
|
XMONAD_GHC=${xmonadEnv}/bin/ghc XMONAD_XMESSAGE=${xmessage}/bin/xmessage xmonad &
|
|
waitPID=$!
|
|
'';
|
|
}];
|
|
};
|
|
|
|
environment.systemPackages = [ cfg.haskellPackages.xmonad ];
|
|
};
|
|
}
|