1{
2 config,
3 pkgs,
4 lib,
5 ...
6}:
7
8with lib;
9
10let
11 cfg = config.services.xserver.windowManager.qtile;
12in
13
14{
15 imports = [
16 (mkRemovedOptionModule [
17 "services"
18 "xserver"
19 "windowManager"
20 "qtile"
21 "backend"
22 ] "The qtile package now provides separate display sessions for both X11 and Wayland.")
23 ];
24
25 options.services.xserver.windowManager.qtile = {
26 enable = mkEnableOption "qtile";
27
28 package = mkPackageOption pkgs "qtile-unwrapped" { };
29
30 configFile = mkOption {
31 type = with types; nullOr path;
32 default = null;
33 example = literalExpression "./your_config.py";
34 description = ''
35 Path to the qtile configuration file.
36 If null, $XDG_CONFIG_HOME/qtile/config.py will be used.
37 '';
38 };
39
40 extraPackages = mkOption {
41 type = types.functionTo (types.listOf types.package);
42 default = _: [ ];
43 defaultText = literalExpression ''
44 python3Packages: with python3Packages; [];
45 '';
46 description = ''
47 Extra Python packages available to Qtile.
48 An example would be to include `python3Packages.qtile-extras`
49 for additional unofficial widgets.
50 '';
51 example = literalExpression ''
52 python3Packages: with python3Packages; [
53 qtile-extras
54 ];
55 '';
56 };
57
58 finalPackage = mkOption {
59 type = types.package;
60 visible = false;
61 readOnly = true;
62 description = "The resulting Qtile package, bundled with extra packages";
63 };
64 };
65
66 config = mkIf cfg.enable {
67 services = {
68 xserver.windowManager.qtile.finalPackage = pkgs.python3.pkgs.qtile.override {
69 extraPackages = cfg.extraPackages pkgs.python3.pkgs;
70 };
71 displayManager.sessionPackages = [ cfg.finalPackage ];
72 };
73
74 environment = {
75 etc."xdg/qtile/config.py" = mkIf (cfg.configFile != null) { source = cfg.configFile; };
76 systemPackages = [ cfg.finalPackage ];
77 };
78 };
79}