xmonad service: add .config option
This commit is contained in:
parent
e814fba316
commit
3eefc0b909
|
@ -10,6 +10,14 @@ let
|
||||||
optionals cfg.enableContribAndExtras
|
optionals cfg.enableContribAndExtras
|
||||||
[ self.xmonad-contrib self.xmonad-extras ];
|
[ self.xmonad-contrib self.xmonad-extras ];
|
||||||
};
|
};
|
||||||
|
xmonadBin = pkgs.writers.writeHaskell "xmonad" {
|
||||||
|
ghc = cfg.haskellPackages.ghc;
|
||||||
|
libraries = [ cfg.haskellPackages.xmonad ] ++
|
||||||
|
cfg.extraPackages cfg.haskellPackages ++
|
||||||
|
optionals cfg.enableContribAndExtras
|
||||||
|
(with cfg.haskellPackages; [ xmonad-contrib xmonad-extras ]);
|
||||||
|
} cfg.config;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
@ -48,13 +56,36 @@ in
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
description = "Enable xmonad-{contrib,extras} in Xmonad.";
|
description = "Enable xmonad-{contrib,extras} in Xmonad.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = with lib.types; nullOr (either path string);
|
||||||
|
description = ''
|
||||||
|
Configuration from which XMonad gets compiled. If no value
|
||||||
|
is specified, the xmonad config from $HOME/.xmonad is taken.
|
||||||
|
If you use xmonad --recompile, $HOME/.xmonad will be taken as
|
||||||
|
the configuration, but on the next restart of display-manager
|
||||||
|
this config will be reapplied.
|
||||||
|
'';
|
||||||
|
example = ''
|
||||||
|
import XMonad
|
||||||
|
|
||||||
|
main = launch defaultConfig
|
||||||
|
{ modMask = mod4Mask -- Use Super instead of Alt
|
||||||
|
, terminal = "urxvt"
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.xserver.windowManager = {
|
services.xserver.windowManager = {
|
||||||
session = [{
|
session = [{
|
||||||
name = "xmonad";
|
name = "xmonad";
|
||||||
start = ''
|
start = if (cfg.config != null) then ''
|
||||||
|
${xmonadBin}
|
||||||
|
waitPID=$!
|
||||||
|
'' else ''
|
||||||
${xmonad}/bin/xmonad &
|
${xmonad}/bin/xmonad &
|
||||||
waitPID=$!
|
waitPID=$!
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -12,6 +12,12 @@ import ./make-test.nix ({ pkgs, ...} : {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableContribAndExtras = true;
|
enableContribAndExtras = true;
|
||||||
extraPackages = with pkgs.haskellPackages; haskellPackages: [ xmobar ];
|
extraPackages = with pkgs.haskellPackages; haskellPackages: [ xmobar ];
|
||||||
|
config = ''
|
||||||
|
import XMonad
|
||||||
|
import XMonad.Util.EZConfig
|
||||||
|
main = launch $ def `additionalKeysP` myKeys
|
||||||
|
myKeys = [ ("M-C-x", spawn "xterm") ]
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,6 +25,10 @@ import ./make-test.nix ({ pkgs, ...} : {
|
||||||
$machine->waitForX;
|
$machine->waitForX;
|
||||||
$machine->waitForFile("/home/alice/.Xauthority");
|
$machine->waitForFile("/home/alice/.Xauthority");
|
||||||
$machine->succeed("xauth merge ~alice/.Xauthority");
|
$machine->succeed("xauth merge ~alice/.Xauthority");
|
||||||
|
$machine->sendKeys("alt-ctrl-x");
|
||||||
|
$machine->waitForWindow(qr/machine.*alice/);
|
||||||
|
$machine->sleep(1);
|
||||||
|
$machine->screenshot("terminal");
|
||||||
$machine->waitUntilSucceeds("xmonad --restart");
|
$machine->waitUntilSucceeds("xmonad --restart");
|
||||||
$machine->sleep(3);
|
$machine->sleep(3);
|
||||||
$machine->sendKeys("alt-shift-ret");
|
$machine->sendKeys("alt-shift-ret");
|
||||||
|
|
Loading…
Reference in New Issue