about summary refs log tree commit diff
path: root/nixos/modules/services/x11/window-managers/qtile.nix
blob: 4603ca3fb50f07fdfe975afb7cdea2a3864d6c99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ config, pkgs, lib, ... }:

with lib;

let
  cfg = config.services.xserver.windowManager.qtile;
in

{
  imports = [
    (mkRemovedOptionModule [ "services" "xserver" "windowManager" "qtile" "backend" ] "The qtile package now provides separate display sessions for both X11 and Wayland.")
  ];

  options.services.xserver.windowManager.qtile = {
    enable = mkEnableOption "qtile";

    package = mkPackageOption pkgs "qtile-unwrapped" { };

    configFile = mkOption {
      type = with types; nullOr path;
      default = null;
      example = literalExpression "./your_config.py";
      description = ''
          Path to the qtile configuration file.
          If null, $XDG_CONFIG_HOME/qtile/config.py will be used.
      '';
    };

    extraPackages = mkOption {
        type = types.functionTo (types.listOf types.package);
        default = _: [];
        defaultText = literalExpression ''
          python3Packages: with python3Packages; [];
        '';
        description = ''
          Extra Python packages available to Qtile.
          An example would be to include `python3Packages.qtile-extras`
          for additional unofficial widgets.
        '';
        example = literalExpression ''
          python3Packages: with python3Packages; [
            qtile-extras
          ];
        '';
      };

    finalPackage = mkOption {
      type = types.package;
      visible = false;
      readOnly = true;
      description = "The resulting Qtile package, bundled with extra packages";
    };
  };

  config = mkIf cfg.enable {
    services = {
      xserver.windowManager.qtile.finalPackage = pkgs.python3.pkgs.qtile.override { extraPackages = cfg.extraPackages pkgs.python3.pkgs; };
      displayManager.sessionPackages = [ cfg.finalPackage ];
    };

    environment = {
      etc."xdg/qtile/config.py" = mkIf (cfg.configFile != null) { source = cfg.configFile; };
      systemPackages = [ cfg.finalPackage ];
    };
  };
}