xmonad: add module
This commit is contained in:
parent
aa974c0dc3
commit
169968e1e1
|
@ -256,6 +256,13 @@ in
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2017-09-29T12:28:31+00:00";
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'xsession.windowManager.xmonad'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
time = "2017-09-30T09:44:18+00:00";
|
time = "2017-09-30T09:44:18+00:00";
|
||||||
condition = with config.programs.vim;
|
condition = with config.programs.vim;
|
||||||
|
|
86
modules/services/window-managers/xmonad.nix
Normal file
86
modules/services/window-managers/xmonad.nix
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
{ pkgs }: { config, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.xmonad;
|
||||||
|
|
||||||
|
xmonad = pkgs.xmonad-with-packages.override {
|
||||||
|
ghcWithPackages = cfg.haskellPackages.ghcWithPackages;
|
||||||
|
packages = self:
|
||||||
|
cfg.extraPackages self
|
||||||
|
++ optionals cfg.enableContribAndExtras [
|
||||||
|
self.xmonad-contrib self.xmonad-extras
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
xmonad = {
|
||||||
|
enable = mkEnableOption "xmonad";
|
||||||
|
|
||||||
|
haskellPackages = mkOption {
|
||||||
|
default = pkgs.haskellPackages;
|
||||||
|
defaultText = "pkgs.haskellPackages";
|
||||||
|
example = literalExample "pkgs.haskell.packages.ghc784";
|
||||||
|
description = ''
|
||||||
|
The <varname>haskellPackages</varname> 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 = self: [];
|
||||||
|
defaultText = "self: []";
|
||||||
|
example = literalExample ''
|
||||||
|
haskellPackages: [
|
||||||
|
haskellPackages.xmonad-contrib
|
||||||
|
haskellPackages.monad-logger
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Extra packages available to GHC when rebuilding xmonad. The
|
||||||
|
value must be a function which receives the attribute set
|
||||||
|
defined in <varname>haskellPackages</varname> as the sole
|
||||||
|
argument.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
enableContribAndExtras = mkOption {
|
||||||
|
default = false;
|
||||||
|
type = types.bool;
|
||||||
|
description = "Enable xmonad-{contrib,extras} in xmonad.";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkOption {
|
||||||
|
type = types.nullOr types.path;
|
||||||
|
default = null;
|
||||||
|
example = literalExample ''
|
||||||
|
pkgs.writeText "xmonad.hs" '''
|
||||||
|
import XMonad
|
||||||
|
main = xmonad defaultConfig
|
||||||
|
{ terminal = "urxvt"
|
||||||
|
, modMask = mod4Mask
|
||||||
|
, borderWidth = 3
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
The configuration file to be used for xmonad. This must be
|
||||||
|
an absolute path or <literal>null</literal> in which case
|
||||||
|
<filename>~/.xmonad/xmonad.hs</filename> will not be managed
|
||||||
|
by Home Manager.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
command = "${xmonad}/bin/xmonad";
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
with import ./lib/dag.nix { inherit lib; };
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
@ -32,6 +33,9 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xmonadModule =
|
||||||
|
import ./services/window-managers/xmonad.nix { inherit pkgs; };
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -46,7 +50,7 @@ in
|
||||||
types.coercedTo
|
types.coercedTo
|
||||||
types.str
|
types.str
|
||||||
(command: { inherit command; usesDeprecated = true; })
|
(command: { inherit command; usesDeprecated = true; })
|
||||||
(types.submodule wmBaseModule);
|
(types.submodule [ wmBaseModule xmonadModule ]);
|
||||||
description = ''
|
description = ''
|
||||||
Window manager start command. DEPRECATED: Use
|
Window manager start command. DEPRECATED: Use
|
||||||
<varname>xsession.windowManager.command</varname> instead.
|
<varname>xsession.windowManager.command</varname> instead.
|
||||||
|
@ -69,6 +73,28 @@ in
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf (cfg.windowManager.xmonad.enable
|
||||||
|
&& cfg.windowManager.xmonad.config != null) {
|
||||||
|
home.file.".xmonad/xmonad.hs".source = cfg.windowManager.xmonad.config;
|
||||||
|
|
||||||
|
home.activation.checkXMonad = dagEntryBefore [ "linkGeneration" ] ''
|
||||||
|
if ! cmp --quiet \
|
||||||
|
"${cfg.windowManager.xmonad.config}" \
|
||||||
|
"$HOME/.xmonad/xmonad.hs"; then
|
||||||
|
_XMONAD_CHANGED=1
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
home.activation.applyXMonad = dagEntryAfter [ "linkGeneration" ] ''
|
||||||
|
if [[ -v _XMONAD_CHANGED ]]; then
|
||||||
|
echo Recompiling Xmonad
|
||||||
|
${cfg.windowManager.command} --recompile
|
||||||
|
echo Restarting Xmonad
|
||||||
|
${cfg.windowManager.command} --restart
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
{
|
{
|
||||||
systemd.user.services.setxkbmap = {
|
systemd.user.services.setxkbmap = {
|
||||||
Unit = {
|
Unit = {
|
||||||
|
|
Loading…
Reference in a new issue