parent
b60b7eeaab
commit
688d7cd3a6
@ -3,37 +3,43 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.xserver.windowManager.i3;
|
wmCfg = config.services.xserver.windowManager;
|
||||||
|
|
||||||
|
i3option = name: {
|
||||||
|
enable = mkEnableOption name;
|
||||||
|
configFile = mkOption {
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.path;
|
||||||
|
description = ''
|
||||||
|
Path to the i3 configuration file.
|
||||||
|
If left at the default value, $HOME/.i3/config will be used.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
i3config = name: pkg: cfg: {
|
||||||
|
services.xserver.windowManager.session = [{
|
||||||
|
inherit name;
|
||||||
|
start = ''
|
||||||
|
${pkg}/bin/i3 ${optionalString (cfg.configFile != null)
|
||||||
|
"-c \"${cfg.configFile}\""
|
||||||
|
} &
|
||||||
|
waitPID=$!
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
environment.systemPackages = [ pkg ];
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options = {
|
options.services.xserver.windowManager = {
|
||||||
services.xserver.windowManager.i3 = {
|
i3 = i3option "i3";
|
||||||
enable = mkEnableOption "i3";
|
i3-gaps = i3option "i3-gaps";
|
||||||
|
|
||||||
configFile = mkOption {
|
|
||||||
default = null;
|
|
||||||
type = types.nullOr types.path;
|
|
||||||
description = ''
|
|
||||||
Path to the i3 configuration file.
|
|
||||||
If left at the default value, $HOME/.i3/config will be used.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkMerge [
|
||||||
services.xserver.windowManager = {
|
(mkIf wmCfg.i3.enable (i3config "i3" pkgs.i3 wmCfg.i3))
|
||||||
session = [{
|
(mkIf wmCfg.i3-gaps.enable (i3config "i3-gaps" pkgs.i3-gaps wmCfg.i3-gaps))
|
||||||
name = "i3";
|
];
|
||||||
start = ''
|
|
||||||
${pkgs.i3}/bin/i3 ${optionalString (cfg.configFile != null)
|
|
||||||
"-c \"${cfg.configFile}\""
|
|
||||||
} &
|
|
||||||
waitPID=$!
|
|
||||||
'';
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
environment.systemPackages = with pkgs; [ i3 ];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user