From 2f5f1647c36f08195b008f6d5e4418d4e8c3dc29 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Fri, 11 Aug 2023 18:45:51 -0400 Subject: [PATCH 1/7] pythonPackages: add qt6 override A few qt6 modules require python. We need to override with the appropriate python version in order to use qt6 with non-default python packages (like python311). --- pkgs/development/libraries/qt-6/default.nix | 3 ++- pkgs/development/python-modules/pyside6/default.nix | 3 +-- pkgs/development/python-modules/shiboken6/default.nix | 3 +-- pkgs/top-level/python-packages.nix | 8 ++++++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/qt-6/default.nix b/pkgs/development/libraries/qt-6/default.nix index 0a4fbe713ec..d0c298e5192 100644 --- a/pkgs/development/libraries/qt-6/default.nix +++ b/pkgs/development/libraries/qt-6/default.nix @@ -9,6 +9,7 @@ , libglvnd , darwin , buildPackages +, python3 # options , developerBuild ? false @@ -24,7 +25,7 @@ let addPackages = self: with self; let callPackage = self.newScope ({ - inherit qtModule srcs; + inherit qtModule srcs python3; stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv; }); in diff --git a/pkgs/development/python-modules/pyside6/default.nix b/pkgs/development/python-modules/pyside6/default.nix index 0cf06e885c1..d261298f5eb 100644 --- a/pkgs/development/python-modules/pyside6/default.nix +++ b/pkgs/development/python-modules/pyside6/default.nix @@ -2,7 +2,6 @@ , stdenv , cmake , ninja -, qt6 , python , moveBuildTree , shiboken6 @@ -34,7 +33,7 @@ stdenv.mkDerivation rec { moveBuildTree ]; - buildInputs = with qt6; [ + buildInputs = with python.pkgs.qt6; [ # required qtbase ] ++ lib.optionals stdenv.isLinux [ diff --git a/pkgs/development/python-modules/shiboken6/default.nix b/pkgs/development/python-modules/shiboken6/default.nix index 9bf4f0d6482..895542c7793 100644 --- a/pkgs/development/python-modules/shiboken6/default.nix +++ b/pkgs/development/python-modules/shiboken6/default.nix @@ -2,7 +2,6 @@ , fetchurl , llvmPackages , python -, qt6 , cmake , autoPatchelfHook , stdenv @@ -35,7 +34,7 @@ llvmPackages.stdenv.mkDerivation rec { buildInputs = [ llvmPackages.llvm llvmPackages.libclang - qt6.qtbase + python.pkgs.qt6.qtbase ]; cmakeFlags = [ diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a35ab01908d..01cf3c7794b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9894,7 +9894,7 @@ self: super: with self; { }); pyside6 = toPythonModule (callPackage ../development/python-modules/pyside6 { - inherit (pkgs) cmake ninja qt6; + inherit (pkgs) cmake ninja; }); pyside = callPackage ../development/python-modules/pyside { @@ -10912,6 +10912,10 @@ self: super: with self; { qt5reactor = callPackage ../development/python-modules/qt5reactor { }; + qt6 = pkgs.qt6.override { + python3 = self.python; + }; + qtawesome = callPackage ../development/python-modules/qtawesome { }; qtconsole = callPackage ../development/python-modules/qtconsole { }; @@ -11735,7 +11739,7 @@ self: super: with self; { }); shiboken6 = toPythonModule (callPackage ../development/python-modules/shiboken6 { - inherit (pkgs) cmake llvmPackages qt6; + inherit (pkgs) cmake llvmPackages; }); shippai = callPackage ../development/python-modules/shippai { }; From 1df4a27001f8c57a639422468c70d2e7240f8349 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sun, 6 Aug 2023 18:26:14 -0400 Subject: [PATCH 2/7] pythonPackages.shiboken6: add egg_info --- pkgs/development/python-modules/shiboken6/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/python-modules/shiboken6/default.nix b/pkgs/development/python-modules/shiboken6/default.nix index 895542c7793..d63e86201f2 100644 --- a/pkgs/development/python-modules/shiboken6/default.nix +++ b/pkgs/development/python-modules/shiboken6/default.nix @@ -35,6 +35,9 @@ llvmPackages.stdenv.mkDerivation rec { llvmPackages.llvm llvmPackages.libclang python.pkgs.qt6.qtbase + python.pkgs.ninja + python.pkgs.packaging + python.pkgs.setuptools ]; cmakeFlags = [ @@ -53,6 +56,12 @@ llvmPackages.stdenv.mkDerivation rec { patchelf $out/${python.sitePackages}/shiboken6/Shiboken.abi3.so --shrink-rpath --allowed-rpath-prefixes ${builtins.storeDir} ''; + postInstall = '' + cd ../../.. + ${python.pythonForBuild.interpreter} setup.py egg_info --build-type=shiboken6 + cp -r shiboken6.egg-info $out/${python.sitePackages}/ + ''; + dontWrapQtApps = true; meta = with lib; { From 041e8955d707a6fea4782e5f348f497725ada69c Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sun, 6 Aug 2023 19:37:27 -0400 Subject: [PATCH 3/7] pythonPackages.pyside6: add egg_info --- pkgs/development/python-modules/pyside6/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/python-modules/pyside6/default.nix b/pkgs/development/python-modules/pyside6/default.nix index d261298f5eb..55aff7dee29 100644 --- a/pkgs/development/python-modules/pyside6/default.nix +++ b/pkgs/development/python-modules/pyside6/default.nix @@ -36,6 +36,9 @@ stdenv.mkDerivation rec { buildInputs = with python.pkgs.qt6; [ # required qtbase + python.pkgs.ninja + python.pkgs.packaging + python.pkgs.setuptools ] ++ lib.optionals stdenv.isLinux [ # optional qt3d @@ -68,6 +71,12 @@ stdenv.mkDerivation rec { dontWrapQtApps = true; + postInstall = '' + cd ../../.. + ${python.pythonForBuild.interpreter} setup.py egg_info --build-type=pyside6 + cp -r PySide6.egg-info $out/${python.sitePackages}/ + ''; + meta = with lib; { description = "Python bindings for Qt"; license = with licenses; [ lgpl3Only gpl2Only gpl3Only ]; From 58671ffebe524aadbef3abbfa52553ed050ad18f Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Fri, 11 Aug 2023 18:53:44 -0400 Subject: [PATCH 4/7] streamdeck-ui: use new repo --- pkgs/applications/misc/streamdeck-ui/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/misc/streamdeck-ui/default.nix b/pkgs/applications/misc/streamdeck-ui/default.nix index 1c1aa80de79..d80c82ea898 100644 --- a/pkgs/applications/misc/streamdeck-ui/default.nix +++ b/pkgs/applications/misc/streamdeck-ui/default.nix @@ -15,8 +15,8 @@ python3Packages.buildPythonApplication rec { version = "2.0.6"; src = fetchFromGitHub { - repo = pname; - owner = "timothycrosley"; + repo = "streamdeck-linux-gui"; + owner = "streamdeck-linux-gui"; rev = "v${version}"; sha256 = "sha256-5dk+5oefg5R68kv038gsZ2p5ixmpj/vBLBp/V7Sdos8="; }; @@ -100,7 +100,7 @@ python3Packages.buildPythonApplication rec { meta = with lib; { description = "Linux compatible UI for the Elgato Stream Deck"; - homepage = "https://timothycrosley.github.io/streamdeck-ui/"; + homepage = "https://streamdeck-linux-gui.github.io/streamdeck-linux-gui/"; license = licenses.mit; maintainers = with maintainers; [ majiir ]; }; From a02a5025c1e6c4a4891bc2c1b4615120c0170470 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Fri, 11 Aug 2023 18:54:43 -0400 Subject: [PATCH 5/7] streamdeck-ui: add systemd user service --- pkgs/applications/misc/streamdeck-ui/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/applications/misc/streamdeck-ui/default.nix b/pkgs/applications/misc/streamdeck-ui/default.nix index d80c82ea898..ea4ca011e2d 100644 --- a/pkgs/applications/misc/streamdeck-ui/default.nix +++ b/pkgs/applications/misc/streamdeck-ui/default.nix @@ -51,6 +51,10 @@ python3Packages.buildPythonApplication rec { ''; in '' + mkdir -p $out/lib/systemd/user + substitute scripts/streamdeck.service $out/lib/systemd/user/streamdeck.service \ + --replace '' $out/bin/streamdeck + mkdir -p "$out/etc/udev/rules.d" cp ${writeText "70-streamdeck.rules" udevRules} $out/etc/udev/rules.d/70-streamdeck.rules From 0fb2fbc3934318d52d3ae3f0d49efd143eac9388 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Fri, 11 Aug 2023 18:55:27 -0400 Subject: [PATCH 6/7] streamdeck-ui: 2.0.6 -> 3.0.1 --- .../misc/streamdeck-ui/default.nix | 31 ++++++------------- .../misc/streamdeck-ui/update-pillow.patch | 13 ++++++++ pkgs/top-level/all-packages.nix | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 pkgs/applications/misc/streamdeck-ui/update-pillow.patch diff --git a/pkgs/applications/misc/streamdeck-ui/default.nix b/pkgs/applications/misc/streamdeck-ui/default.nix index ea4ca011e2d..e43ddf067a7 100644 --- a/pkgs/applications/misc/streamdeck-ui/default.nix +++ b/pkgs/applications/misc/streamdeck-ui/default.nix @@ -1,37 +1,27 @@ { lib , python3Packages , fetchFromGitHub -, fetchpatch , copyDesktopItems -, wrapQtAppsHook , writeText , makeDesktopItem , xvfb-run -, qt5 +, qt6 }: python3Packages.buildPythonApplication rec { pname = "streamdeck-ui"; - version = "2.0.6"; + version = "3.0.1"; src = fetchFromGitHub { repo = "streamdeck-linux-gui"; owner = "streamdeck-linux-gui"; rev = "v${version}"; - sha256 = "sha256-5dk+5oefg5R68kv038gsZ2p5ixmpj/vBLBp/V7Sdos8="; + sha256 = "sha256-nLtWExxufxT5nRiEYLGNeMhFhvlGzYKA+crA74Yt4ck="; }; patches = [ - (fetchpatch { - name = "use-poetry-core.patch"; - url = "https://github.com/timothycrosley/streamdeck-ui/commit/e271656c1f47b1619d1b942e2ebb01ab2d6a68a9.patch"; - hash = "sha256-wqYwX6eSqMnW6OG7wSprD62Dz818ayFduVrqW9E/ays="; - }) - (fetchpatch { - name = "update-python-xlib-0.33.patch"; - url = "https://github.com/timothycrosley/streamdeck-ui/commit/07d7fdd33085b413dd26b02d8a02820edad2d568.patch"; - hash = "sha256-PylTrbfB8RJ0+kbgJlRdcvfdahGoob8LabwhuFNsUpY="; - }) + # nixpkgs has a newer pillow version + ./update-pillow.patch ]; desktopItems = [ (makeDesktopItem { @@ -70,7 +60,7 @@ python3Packages.buildPythonApplication rec { nativeBuildInputs = [ python3Packages.poetry-core copyDesktopItems - wrapQtAppsHook + qt6.wrapQtAppsHook ]; propagatedBuildInputs = with python3Packages; [ @@ -79,11 +69,11 @@ python3Packages.buildPythonApplication rec { cairosvg pillow pynput - pyside2 + pyside6 streamdeck xlib ] ++ lib.optionals stdenv.isLinux [ - qt5.qtwayland + qt6.qtwayland ]; nativeCheckInputs = [ @@ -93,13 +83,10 @@ python3Packages.buildPythonApplication rec { ]; # Ignored tests are not in a running or passing state. - # Fixes have been merged upstream but not yet released. # Revisit these ignored tests on each update. checkPhase = '' xvfb-run pytest tests \ - --ignore=tests/test_api.py \ - --ignore=tests/test_filter.py \ - --ignore=tests/test_stream_deck_monitor.py + --ignore=tests/test_api.py ''; meta = with lib; { diff --git a/pkgs/applications/misc/streamdeck-ui/update-pillow.patch b/pkgs/applications/misc/streamdeck-ui/update-pillow.patch new file mode 100644 index 00000000000..88945586628 --- /dev/null +++ b/pkgs/applications/misc/streamdeck-ui/update-pillow.patch @@ -0,0 +1,13 @@ +diff --git a/pyproject.toml b/pyproject.toml +index 0aff29e..4371616 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -14,7 +14,7 @@ packages = [ + [tool.poetry.dependencies] + python = ">=3.8,<3.12" + streamdeck = "^0.9.3" +-pillow = "^9.4.0" ++pillow = "^10.0.0" + pynput = "^1.7.6" + pyside6 = "^6.4.2" + CairoSVG = "^2.5.2" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6454a14b9c4..cd7933a6fa5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32835,7 +32835,7 @@ with pkgs; srain = callPackage ../applications/networking/irc/srain { }; - streamdeck-ui = libsForQt5.callPackage ../applications/misc/streamdeck-ui { }; + streamdeck-ui = callPackage ../applications/misc/streamdeck-ui { }; super-productivity = callPackage ../applications/office/super-productivity { }; From 44813a8a613c8e56db614b2ea450f8ed0d06cbad Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Fri, 11 Aug 2023 23:17:37 -0400 Subject: [PATCH 7/7] streamdeck-ui: split desktop items --- nixos/modules/programs/streamdeck-ui.nix | 2 +- .../misc/streamdeck-ui/default.nix | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/nixos/modules/programs/streamdeck-ui.nix b/nixos/modules/programs/streamdeck-ui.nix index 4c055029e39..220f0a35f16 100644 --- a/nixos/modules/programs/streamdeck-ui.nix +++ b/nixos/modules/programs/streamdeck-ui.nix @@ -24,7 +24,7 @@ in config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ cfg.package - (mkIf cfg.autoStart (makeAutostartItem { name = "streamdeck-ui"; package = cfg.package; })) + (mkIf cfg.autoStart (makeAutostartItem { name = "streamdeck-ui-noui"; package = cfg.package; })) ]; services.udev.packages = [ cfg.package ]; diff --git a/pkgs/applications/misc/streamdeck-ui/default.nix b/pkgs/applications/misc/streamdeck-ui/default.nix index e43ddf067a7..94d2791530a 100644 --- a/pkgs/applications/misc/streamdeck-ui/default.nix +++ b/pkgs/applications/misc/streamdeck-ui/default.nix @@ -24,15 +24,23 @@ python3Packages.buildPythonApplication rec { ./update-pillow.patch ]; - desktopItems = [ (makeDesktopItem { - name = "streamdeck-ui"; - desktopName = "Stream Deck UI"; - icon = "streamdeck-ui"; - exec = "streamdeck --no-ui"; - comment = "UI for the Elgato Stream Deck"; - categories = [ "Utility" ]; - noDisplay = true; - }) ]; + desktopItems = let + common = { + name = "streamdeck-ui"; + desktopName = "Stream Deck UI"; + icon = "streamdeck-ui"; + exec = "streamdeck"; + comment = "UI for the Elgato Stream Deck"; + categories = [ "Utility" ]; + }; + in builtins.map makeDesktopItem [ + common + (common // { + name = "${common.name}-noui"; + exec = "${common.exec} --no-ui"; + noDisplay = true; + }) + ]; postInstall = let