summary refs log tree commit diff
path: root/nixos/modules/services/x11/window-managers
diff options
context:
space:
mode:
authorKasper Gałkowski <k@galkowski.xyz>2023-03-28 19:43:40 +0200
committerKasper Gałkowski <k@galkowski.xyz>2023-03-28 19:43:40 +0200
commit9a26e2dea92566db6151fef2909140992a751207 (patch)
tree408339819743edd60093033d990deffb34c54569 /nixos/modules/services/x11/window-managers
parent218b8ac2a90f021c3f44c1dfd5a5264d384b873d (diff)
parent49079a134fd3d3ac25d5ae1f5516f37770f19138 (diff)
downloadnixpkgs-9a26e2dea92566db6151fef2909140992a751207.tar
nixpkgs-9a26e2dea92566db6151fef2909140992a751207.tar.gz
nixpkgs-9a26e2dea92566db6151fef2909140992a751207.tar.bz2
nixpkgs-9a26e2dea92566db6151fef2909140992a751207.tar.lz
nixpkgs-9a26e2dea92566db6151fef2909140992a751207.tar.xz
nixpkgs-9a26e2dea92566db6151fef2909140992a751207.tar.zst
nixpkgs-9a26e2dea92566db6151fef2909140992a751207.zip
merge master
Diffstat (limited to 'nixos/modules/services/x11/window-managers')
-rw-r--r--nixos/modules/services/x11/window-managers/qtile.nix46
1 files changed, 43 insertions, 3 deletions
diff --git a/nixos/modules/services/x11/window-managers/qtile.nix b/nixos/modules/services/x11/window-managers/qtile.nix
index fc27566d49e..cc24522970f 100644
--- a/nixos/modules/services/x11/window-managers/qtile.nix
+++ b/nixos/modules/services/x11/window-managers/qtile.nix
@@ -1,23 +1,63 @@
-{ config, lib, pkgs, ... }:
+{ config, pkgs, lib, ... }:
 
 with lib;
 
 let
   cfg = config.services.xserver.windowManager.qtile;
+  pyEnv = pkgs.python3.withPackages (p: [ (cfg.package.unwrapped or cfg.package) ] ++ (cfg.extraPackages p));
 in
 
 {
   options.services.xserver.windowManager.qtile = {
     enable = mkEnableOption (lib.mdDoc "qtile");
 
-    package = mkPackageOptionMD pkgs "qtile" { };
+    package = mkPackageOptionMD pkgs "qtile-unwrapped" { };
+
+    configFile = mkOption {
+      type = with types; nullOr path;
+      default = null;
+      example = literalExpression "./your_config.py";
+      description = lib.mdDoc ''
+          Path to the qtile configuration file.
+          If null, $XDG_CONFIG_HOME/qtile/config.py will be used.
+      '';
+    };
+
+    backend = mkOption {
+      type = types.enum [ "x11" "wayland" ];
+      default = "x11";
+      description = lib.mdDoc ''
+          Backend to use in qtile:
+          <option>x11</option> or <option>wayland</option>.
+      '';
+    };
+
+    extraPackages = mkOption {
+        type = types.functionTo (types.listOf types.package);
+        default = _: [];
+        defaultText = literalExpression ''
+          python3Packages: with python3Packages; [];
+        '';
+        description = lib.mdDoc ''
+          Extra Python packages available to Qtile.
+          An example would be to include `python3Packages.qtile-extras`
+          for additional unoffical widgets.
+        '';
+        example = literalExpression ''
+          python3Packages: with python3Packages; [
+            qtile-extras
+          ];
+        '';
+      };
   };
 
   config = mkIf cfg.enable {
     services.xserver.windowManager.session = [{
       name = "qtile";
       start = ''
-        ${cfg.package}/bin/qtile start &
+        ${pyEnv}/bin/qtile start -b ${cfg.backend} \
+        ${optionalString (cfg.configFile != null)
+        "--config \"${cfg.configFile}\""} &
         waitPID=$!
       '';
     }];