diff --git a/nixos/modules/services/x11/window-managers/qtile.nix b/nixos/modules/services/x11/window-managers/qtile.nix
index fc27566d49ee..cc24522970f3 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:
+ or .
+ '';
+ };
+
+ 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=$!
'';
}];
diff --git a/pkgs/applications/window-managers/qtile/default.nix b/pkgs/applications/window-managers/qtile/default.nix
index 1279397cccc2..173dc919c74e 100644
--- a/pkgs/applications/window-managers/qtile/default.nix
+++ b/pkgs/applications/window-managers/qtile/default.nix
@@ -11,86 +11,77 @@
, wayland
, wlroots
, xcbutilcursor
+, pulseaudio
}:
-let
- unwrapped = python3Packages.buildPythonPackage rec {
- pname = "qtile";
- version = "0.22.1";
+python3Packages.buildPythonPackage rec {
+ pname = "qtile";
+ version = "0.22.1";
- src = fetchFromGitHub {
- owner = "qtile";
- repo = "qtile";
- rev = "v${version}";
- hash = "sha256-HOyExVKOqZ4OeNM1/AiXQeiUV+EbSJLEjWEibm07ff8=";
- };
-
- patches = [
- ./fix-restart.patch # https://github.com/NixOS/nixpkgs/issues/139568
- ];
-
- postPatch = ''
- substituteInPlace libqtile/pangocffi.py \
- --replace libgobject-2.0.so.0 ${glib.out}/lib/libgobject-2.0.so.0 \
- --replace libpangocairo-1.0.so.0 ${pango.out}/lib/libpangocairo-1.0.so.0 \
- --replace libpango-1.0.so.0 ${pango.out}/lib/libpango-1.0.so.0
- substituteInPlace libqtile/backend/x11/xcursors.py \
- --replace libxcb-cursor.so.0 ${xcbutilcursor.out}/lib/libxcb-cursor.so.0
- '';
-
- SETUPTOOLS_SCM_PRETEND_VERSION = version;
-
- nativeBuildInputs = [
- pkg-config
- ] ++ (with python3Packages; [
- setuptools-scm
- ]);
-
- propagatedBuildInputs = with python3Packages; [
- xcffib
- (cairocffi.override { withXcffib = true; })
- setuptools
- python-dateutil
- dbus-python
- dbus-next
- mpd2
- psutil
- pyxdg
- pygobject3
- pywayland
- pywlroots
- xkbcommon
- ];
-
- buildInputs = [
- libinput
- wayland
- wlroots
- libxkbcommon
- ];
-
- # for `qtile check`, needs `stubtest` and `mypy` commands
- makeWrapperArgs = [
- "--suffix PATH : ${lib.makeBinPath [ mypy ]}"
- ];
-
- doCheck = false; # Requires X server #TODO this can be worked out with the existing NixOS testing infrastructure.
-
- meta = with lib; {
- homepage = "http://www.qtile.org/";
- license = licenses.mit;
- description = "A small, flexible, scriptable tiling window manager written in Python";
- platforms = platforms.linux;
- maintainers = with maintainers; [ kamilchm ];
- };
+ src = fetchFromGitHub {
+ owner = "qtile";
+ repo = "qtile";
+ rev = "v${version}";
+ hash = "sha256-HOyExVKOqZ4OeNM1/AiXQeiUV+EbSJLEjWEibm07ff8=";
};
-in
-(python3.withPackages (_: [ unwrapped ])).overrideAttrs (_: {
- # otherwise will be exported as "env", this restores `nix search` behavior
- name = "${unwrapped.pname}-${unwrapped.version}";
- # export underlying qtile package
- passthru = { inherit unwrapped; };
- # restore original qtile attrs
- inherit (unwrapped) pname version meta;
-})
+ patches = [
+ ./fix-restart.patch # https://github.com/NixOS/nixpkgs/issues/139568
+ ];
+
+ postPatch = ''
+ substituteInPlace libqtile/pangocffi.py \
+ --replace libgobject-2.0.so.0 ${glib.out}/lib/libgobject-2.0.so.0 \
+ --replace libpangocairo-1.0.so.0 ${pango.out}/lib/libpangocairo-1.0.so.0 \
+ --replace libpango-1.0.so.0 ${pango.out}/lib/libpango-1.0.so.0
+ substituteInPlace libqtile/backend/x11/xcursors.py \
+ --replace libxcb-cursor.so.0 ${xcbutilcursor.out}/lib/libxcb-cursor.so.0
+ '';
+
+ SETUPTOOLS_SCM_PRETEND_VERSION = version;
+
+ nativeBuildInputs = [
+ pkg-config
+ ] ++ (with python3Packages; [
+ setuptools-scm
+ ]);
+
+ propagatedBuildInputs = with python3Packages; [
+ xcffib
+ (cairocffi.override { withXcffib = true; })
+ setuptools
+ python-dateutil
+ dbus-python
+ dbus-next
+ mpd2
+ psutil
+ pyxdg
+ pygobject3
+ pywayland
+ pywlroots
+ xkbcommon
+ pulseaudio
+ ];
+
+ buildInputs = [
+ libinput
+ wayland
+ wlroots
+ libxkbcommon
+ ];
+
+ # for `qtile check`, needs `stubtest` and `mypy` commands
+ makeWrapperArgs = [
+ "--suffix PATH : ${lib.makeBinPath [ mypy ]}"
+ ];
+
+ doCheck = false; # Requires X server #TODO this can be worked out with the existing NixOS testing infrastructure.
+
+ meta = with lib; {
+ homepage = "http://www.qtile.org/";
+ license = licenses.mit;
+ description = "A small, flexible, scriptable tiling window manager written in Python";
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ kamilchm arjan-s ];
+ };
+}
diff --git a/pkgs/applications/window-managers/qtile/wrapper.nix b/pkgs/applications/window-managers/qtile/wrapper.nix
new file mode 100644
index 000000000000..8cb5596a8446
--- /dev/null
+++ b/pkgs/applications/window-managers/qtile/wrapper.nix
@@ -0,0 +1,9 @@
+{ python3, qtile-unwrapped }:
+(python3.withPackages (_: [ qtile-unwrapped ])).overrideAttrs (_: {
+ # otherwise will be exported as "env", this restores `nix search` behavior
+ name = "${qtile-unwrapped.pname}-${qtile-unwrapped.version}";
+ # export underlying qtile package
+ passthru = { unwrapped = qtile-unwrapped; };
+ # restore original qtile attrs
+ inherit (qtile-unwrapped) pname version meta;
+})
diff --git a/pkgs/development/python-modules/qtile-extras/default.nix b/pkgs/development/python-modules/qtile-extras/default.nix
index 76962bb49671..3ba8f9487d58 100644
--- a/pkgs/development/python-modules/qtile-extras/default.nix
+++ b/pkgs/development/python-modules/qtile-extras/default.nix
@@ -6,7 +6,7 @@
, xorgserver
, pulseaudio
, pytest-asyncio
-, qtile
+, qtile-unwrapped
, keyring
, requests
, stravalib
@@ -34,7 +34,7 @@ buildPythonPackage rec {
];
checkInputs = [
pytest-asyncio
- qtile.unwrapped
+ qtile-unwrapped
pulseaudio
keyring
requests
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 489e3d50e00c..f136e167c772 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -34113,7 +34113,8 @@ with pkgs;
qpdfview = libsForQt5.callPackage ../applications/office/qpdfview { };
- qtile = callPackage ../applications/window-managers/qtile { };
+ qtile-unwrapped = callPackage ../applications/window-managers/qtile { };
+ qtile = callPackage ../applications/window-managers/qtile/wrapper.nix { };
vimgolf = callPackage ../games/vimgolf { };