diff options
Diffstat (limited to 'pkgs/development/python-modules/qtile')
-rw-r--r-- | pkgs/development/python-modules/qtile/default.nix | 99 | ||||
-rw-r--r-- | pkgs/development/python-modules/qtile/fix-restart.patch | 22 | ||||
-rw-r--r-- | pkgs/development/python-modules/qtile/wrapper.nix | 8 |
3 files changed, 129 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/qtile/default.nix b/pkgs/development/python-modules/qtile/default.nix new file mode 100644 index 0000000000000..bf3f59dcb3bbd --- /dev/null +++ b/pkgs/development/python-modules/qtile/default.nix @@ -0,0 +1,99 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, cairocffi +, dbus-next +, dbus-python +, glib +, libinput +, libxkbcommon +, mpd2 +, mypy +, pango +, pkg-config +, psutil +, pulseaudio +, pygobject3 +, python-dateutil +, pywayland +, pywlroots +, pyxdg +, setuptools +, setuptools-scm +, wayland +, wlroots +, xcbutilcursor +, xcffib +, xkbcommon +}: + +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 + setuptools-scm + setuptools + ]; + + propagatedBuildInputs = [ + xcffib + (cairocffi.override { withXcffib = true; }) + 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/development/python-modules/qtile/fix-restart.patch b/pkgs/development/python-modules/qtile/fix-restart.patch new file mode 100644 index 0000000000000..eca4f0866342f --- /dev/null +++ b/pkgs/development/python-modules/qtile/fix-restart.patch @@ -0,0 +1,22 @@ +diff --git a/libqtile/core/lifecycle.py b/libqtile/core/lifecycle.py +index 0d4d119d..c37d1799 100644 +--- a/libqtile/core/lifecycle.py ++++ b/libqtile/core/lifecycle.py +@@ -25,7 +25,7 @@ class LifeCycle: + + def _atexit(self) -> None: + if self.behavior is Behavior.RESTART: +- argv = [sys.executable] + sys.argv ++ argv = sys.argv + if "--no-spawn" not in argv: + argv.append("--no-spawn") + argv = [s for s in argv if not s.startswith("--with-state")] +@@ -33,7 +33,7 @@ class LifeCycle: + argv.append("--with-state=" + self.state_file) + logger.warning("Restarting Qtile with os.execv(...)") + # No other code will execute after the following line does +- os.execv(sys.executable, argv) ++ os.execv(sys.argv[0], argv) + elif self.behavior is Behavior.TERMINATE: + logger.warning("Qtile will now terminate") + elif self.behavior is Behavior.NONE: diff --git a/pkgs/development/python-modules/qtile/wrapper.nix b/pkgs/development/python-modules/qtile/wrapper.nix new file mode 100644 index 0000000000000..b4f6e4c2e23b2 --- /dev/null +++ b/pkgs/development/python-modules/qtile/wrapper.nix @@ -0,0 +1,8 @@ +{ python3 }: + +(python3.withPackages (_: [ python3.pkgs.qtile ])).overrideAttrs (_: { + # restore some qtile attrs, beautify name + inherit (python3.pkgs.qtile) pname version meta; + name = with python3.pkgs.qtile; "${pname}-${version}"; + passthru.unwrapped = python3.pkgs.qtile; +}) |