From 0377e02b2896679952446ac8ae91e7ffaf735522 Mon Sep 17 00:00:00 2001 From: Ulrik Strid Date: Mon, 10 Jun 2024 22:05:10 +0200 Subject: [PATCH 1/5] streamdeck-ui: 3.1.0 -> 4.1.2 --- .../misc/streamdeck-ui/default.nix | 61 ++++++++++++------- .../misc/streamdeck-ui/update-pillow.patch | 13 ---- 2 files changed, 39 insertions(+), 35 deletions(-) delete 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 f8ecf3694e51..f77c093331fe 100644 --- a/pkgs/applications/misc/streamdeck-ui/default.nix +++ b/pkgs/applications/misc/streamdeck-ui/default.nix @@ -1,6 +1,7 @@ { lib , python3Packages , fetchFromGitHub +, fetchPypi , copyDesktopItems , writeText , makeDesktopItem @@ -8,23 +9,28 @@ , xvfb-run , qt6 }: - +let + # There are breaking changes between 6 and 7 + importlib-metadata_6 = python3Packages.importlib-metadata.overrideAttrs (_: rec { + version = "6.9.0"; + src = fetchPypi { + pname = "importlib_metadata"; + inherit version; + hash = "sha256-6Ky1I8M1qRgiZ04Um0bAOZ7E0yjE0fbknCc9pf8CAbk="; + }; + }); +in python3Packages.buildPythonApplication rec { pname = "streamdeck-ui"; - version = "3.1.0"; + version = "4.1.2"; src = fetchFromGitHub { repo = "streamdeck-linux-gui"; owner = "streamdeck-linux-gui"; rev = "v${version}"; - sha256 = "sha256-AIE9j022L4WSlHBAu3TT5uE4Ilgk/jYSmU03K8Hs8xY="; + hash = "sha256-CSsFPGnKVQUCND6YOA9kfO41KS85C57YL9LcrWlQRKo="; }; - patches = [ - # nixpkgs has a newer pillow version - ./update-pillow.patch - ]; - desktopItems = let common = { name = "streamdeck-ui"; @@ -69,30 +75,41 @@ python3Packages.buildPythonApplication rec { nativeBuildInputs = [ python3Packages.poetry-core + python3Packages.pythonRelaxDepsHook copyDesktopItems qt6.wrapQtAppsHook wrapGAppsHook3 ]; - propagatedBuildInputs = with python3Packages; [ - setuptools - filetype - cairosvg - pillow - pynput - pyside6 - streamdeck - xlib - ] ++ lib.optionals stdenv.isLinux [ - qt6.qtwayland - ]; + pythonRelaxDeps = [ "pillow" ]; + + propagatedBuildInputs = + with python3Packages; + [ + setuptools + filetype + cairosvg + pillow + pynput + pyside6 + streamdeck + xlib + importlib-metadata_6 + evdev + ] + ++ lib.optionals stdenv.isLinux [ qt6.qtwayland ]; nativeCheckInputs = [ xvfb-run - python3Packages.pytest - ]; + ] ++ (with python3Packages; [ + pytest + pytest-qt + pytest-mock + ]); checkPhase = '' + # The tests needs to find the log file + export STREAMDECK_UI_LOG_FILE=$(pwd)/.streamdeck_ui.log xvfb-run pytest tests ''; diff --git a/pkgs/applications/misc/streamdeck-ui/update-pillow.patch b/pkgs/applications/misc/streamdeck-ui/update-pillow.patch deleted file mode 100644 index 88945586628f..000000000000 --- a/pkgs/applications/misc/streamdeck-ui/update-pillow.patch +++ /dev/null @@ -1,13 +0,0 @@ -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" From 742ed72e6a9acd79a13735a1bfa6aaddca7640ad Mon Sep 17 00:00:00 2001 From: Ulrik Strid Date: Mon, 10 Jun 2024 22:05:41 +0200 Subject: [PATCH 2/5] streamdeck-ui: reformat with rfc formatter --- .../misc/streamdeck-ui/default.nix | 97 ++++++++++--------- 1 file changed, 53 insertions(+), 44 deletions(-) diff --git a/pkgs/applications/misc/streamdeck-ui/default.nix b/pkgs/applications/misc/streamdeck-ui/default.nix index f77c093331fe..9adbea933593 100644 --- a/pkgs/applications/misc/streamdeck-ui/default.nix +++ b/pkgs/applications/misc/streamdeck-ui/default.nix @@ -1,13 +1,14 @@ -{ lib -, python3Packages -, fetchFromGitHub -, fetchPypi -, copyDesktopItems -, writeText -, makeDesktopItem -, wrapGAppsHook3 -, xvfb-run -, qt6 +{ + lib, + python3Packages, + fetchFromGitHub, + fetchPypi, + copyDesktopItems, + writeText, + makeDesktopItem, + wrapGAppsHook3, + xvfb-run, + qt6, }: let # There are breaking changes between 6 and 7 @@ -31,23 +32,28 @@ python3Packages.buildPythonApplication rec { hash = "sha256-CSsFPGnKVQUCND6YOA9kfO41KS85C57YL9LcrWlQRKo="; }; - 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; - }) - ]; + 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 @@ -55,21 +61,24 @@ python3Packages.buildPythonApplication rec { SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", TAG+="uaccess" ''; in - '' - mkdir -p $out/lib/systemd/user - substitute scripts/streamdeck.service $out/lib/systemd/user/streamdeck.service \ - --replace '' $out/bin/streamdeck + '' + 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 + mkdir -p "$out/etc/udev/rules.d" + cp ${writeText "70-streamdeck.rules" udevRules} $out/etc/udev/rules.d/70-streamdeck.rules - mkdir -p "$out/share/pixmaps" - cp streamdeck_ui/logo.png $out/share/pixmaps/streamdeck-ui.png - ''; + mkdir -p "$out/share/pixmaps" + cp streamdeck_ui/logo.png $out/share/pixmaps/streamdeck-ui.png + ''; dontWrapQtApps = true; dontWrapGApps = true; - makeWrapperArgs = [ "\${qtWrapperArgs[@]}" "\${gappsWrapperArgs[@]}"]; + makeWrapperArgs = [ + "\${qtWrapperArgs[@]}" + "\${gappsWrapperArgs[@]}" + ]; format = "pyproject"; @@ -99,13 +108,13 @@ python3Packages.buildPythonApplication rec { ] ++ lib.optionals stdenv.isLinux [ qt6.qtwayland ]; - nativeCheckInputs = [ - xvfb-run - ] ++ (with python3Packages; [ - pytest - pytest-qt - pytest-mock - ]); + nativeCheckInputs = + [ xvfb-run ] + ++ (with python3Packages; [ + pytest + pytest-qt + pytest-mock + ]); checkPhase = '' # The tests needs to find the log file From 0e310bec54ae33b87f0daf39172269d8dae8c9be Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Tue, 11 Jun 2024 10:09:35 -0300 Subject: [PATCH 3/5] streamdeck-ui: remove nested with, add downloadPage --- pkgs/applications/misc/streamdeck-ui/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/misc/streamdeck-ui/default.nix b/pkgs/applications/misc/streamdeck-ui/default.nix index 9adbea933593..7ed88182e62c 100644 --- a/pkgs/applications/misc/streamdeck-ui/default.nix +++ b/pkgs/applications/misc/streamdeck-ui/default.nix @@ -122,11 +122,12 @@ python3Packages.buildPythonApplication rec { xvfb-run pytest tests ''; - meta = with lib; { + meta = { description = "Linux compatible UI for the Elgato Stream Deck"; + downloadPage = "https://github.com/streamdeck-linux-gui/streamdeck-linux-gui/"; homepage = "https://streamdeck-linux-gui.github.io/streamdeck-linux-gui/"; - license = licenses.mit; + license = lib.licenses.mit; mainProgram = "streamdeck"; - maintainers = with maintainers; [ majiir ]; + maintainers = with lib.maintainers; [ majiir ]; }; } From 5881753f6213fa03a250e6d27aea546d4364219c Mon Sep 17 00:00:00 2001 From: Ulrik Strid Date: Wed, 12 Jun 2024 22:07:04 +0200 Subject: [PATCH 4/5] streamdeck-ui: move to by-name --- .../default.nix => by-name/st/streamdeck-ui/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{applications/misc/streamdeck-ui/default.nix => by-name/st/streamdeck-ui/package.nix} (100%) diff --git a/pkgs/applications/misc/streamdeck-ui/default.nix b/pkgs/by-name/st/streamdeck-ui/package.nix similarity index 100% rename from pkgs/applications/misc/streamdeck-ui/default.nix rename to pkgs/by-name/st/streamdeck-ui/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 67c3c0e2bf76..f2ceba040bcb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31670,8 +31670,6 @@ with pkgs; srain = callPackage ../applications/networking/irc/srain { }; - streamdeck-ui = callPackage ../applications/misc/streamdeck-ui { }; - super-productivity = callPackage ../applications/office/super-productivity { }; inherit (callPackages ../development/libraries/wlroots {}) From 45415110232161dd90e986095fa5a9fb1fbd6be9 Mon Sep 17 00:00:00 2001 From: Ulrik Strid Date: Wed, 12 Jun 2024 22:55:40 +0200 Subject: [PATCH 5/5] streamdeck-ui: Fix order of attributes --- pkgs/by-name/st/streamdeck-ui/package.nix | 118 ++++++++++++---------- 1 file changed, 62 insertions(+), 56 deletions(-) diff --git a/pkgs/by-name/st/streamdeck-ui/package.nix b/pkgs/by-name/st/streamdeck-ui/package.nix index 7ed88182e62c..4af7ad66c789 100644 --- a/pkgs/by-name/st/streamdeck-ui/package.nix +++ b/pkgs/by-name/st/streamdeck-ui/package.nix @@ -1,15 +1,16 @@ { - lib, - python3Packages, + copyDesktopItems, fetchFromGitHub, fetchPypi, - copyDesktopItems, - writeText, + lib, makeDesktopItem, - wrapGAppsHook3, - xvfb-run, + python3Packages, qt6, + wrapGAppsHook3, + writeText, + xvfb-run, }: + let # There are breaking changes between 6 and 7 importlib-metadata_6 = python3Packages.importlib-metadata.overrideAttrs (_: rec { @@ -21,6 +22,7 @@ let }; }); in + python3Packages.buildPythonApplication rec { pname = "streamdeck-ui"; version = "4.1.2"; @@ -32,56 +34,10 @@ python3Packages.buildPythonApplication rec { hash = "sha256-CSsFPGnKVQUCND6YOA9kfO41KS85C57YL9LcrWlQRKo="; }; - 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 - udevRules = '' - SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", TAG+="uaccess" - ''; - 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 - - mkdir -p "$out/share/pixmaps" - cp streamdeck_ui/logo.png $out/share/pixmaps/streamdeck-ui.png - ''; - - dontWrapQtApps = true; - dontWrapGApps = true; - makeWrapperArgs = [ - "\${qtWrapperArgs[@]}" - "\${gappsWrapperArgs[@]}" - ]; - format = "pyproject"; + pythonRelaxDeps = [ "pillow" ]; + nativeBuildInputs = [ python3Packages.poetry-core python3Packages.pythonRelaxDepsHook @@ -90,8 +46,6 @@ python3Packages.buildPythonApplication rec { wrapGAppsHook3 ]; - pythonRelaxDeps = [ "pillow" ]; - propagatedBuildInputs = with python3Packages; [ @@ -117,11 +71,63 @@ python3Packages.buildPythonApplication rec { ]); checkPhase = '' + runHook preCheck + # The tests needs to find the log file export STREAMDECK_UI_LOG_FILE=$(pwd)/.streamdeck_ui.log xvfb-run pytest tests + + runHook preCheck ''; + postInstall = + let + udevRules = '' + SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", TAG+="uaccess" + ''; + 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 + + mkdir -p "$out/share/pixmaps" + cp streamdeck_ui/logo.png $out/share/pixmaps/streamdeck-ui.png + ''; + + 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; + } + ) + ]; + + dontWrapQtApps = true; + dontWrapGApps = true; + makeWrapperArgs = [ + "\${qtWrapperArgs[@]}" + "\${gappsWrapperArgs[@]}" + ]; + meta = { description = "Linux compatible UI for the Elgato Stream Deck"; downloadPage = "https://github.com/streamdeck-linux-gui/streamdeck-linux-gui/";