1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.services.xserver.windowManager.i3;
7in
8
9{
10 options = {
11 services.xserver.windowManager.i3 = {
12 enable = mkOption {
13 default = false;
14 example = true;
15 description = "Enable the i3 tiling window manager.";
16 };
17
18 configFile = mkOption {
19 default = null;
20 type = types.nullOr types.path;
21 description = ''
22 Path to the i3 configuration file.
23 If left at the default value, $HOME/.i3/config will be used.
24 '';
25 };
26 };
27 };
28
29 config = mkIf cfg.enable {
30 services.xserver.windowManager = {
31 session = [{
32 name = "i3";
33 start = ''
34 ${pkgs.i3}/bin/i3 ${optionalString (cfg.configFile != null)
35 "-c \"${cfg.configFile}\""
36 } &
37 waitPID=$!
38 '';
39 }];
40 };
41 environment.systemPackages = [ pkgs.i3 ];
42 };
43}