Merge pull request #177240 from Majiir/streamdeck-ui

This commit is contained in:
Sandro 2022-07-17 23:27:43 +02:00 committed by GitHub
commit 24aefd2c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 207 additions and 2 deletions

View File

@ -215,6 +215,7 @@
./programs/systemtap.nix
./programs/starship.nix
./programs/steam.nix
./programs/streamdeck-ui.nix
./programs/sway.nix
./programs/system-config-printer.nix
./programs/thefuck.nix

View File

@ -0,0 +1,28 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.streamdeck-ui;
in {
options.programs.streamdeck-ui = {
enable = mkEnableOption "streamdeck-ui";
autoStart = mkOption {
default = true;
type = types.bool;
description = "Whether streamdeck-ui should be started automatically.";
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
streamdeck-ui
(mkIf cfg.autoStart (makeAutostartItem { name = "streamdeck-ui"; package = streamdeck-ui; }))
];
services.udev.packages = with pkgs; [ streamdeck-ui ];
};
meta.maintainers = with maintainers; [ majiir ];
}

View File

@ -0,0 +1,95 @@
{ lib
, python3Packages
, fetchFromGitHub
, poetry
, copyDesktopItems
, wrapQtAppsHook
, writeText
, makeDesktopItem
, xvfb-run
}:
python3Packages.buildPythonApplication rec {
pname = "streamdeck-ui";
version = "2.0.4";
src = fetchFromGitHub {
repo = pname;
owner = "timothycrosley";
rev = "v${version}";
hash = "sha256-NV4BkHEgfxIOuLfmn0vcPNqivmHLD6v7jLdLZgnrb0Q=";
};
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;
}) ];
postInstall =
let
udevRules = ''
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0080", TAG+="uaccess"
'';
in
''
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;
makeWrapperArgs = [ "\${qtWrapperArgs[@]}" ];
format = "pyproject";
nativeBuildInputs = [
poetry
copyDesktopItems
wrapQtAppsHook
];
propagatedBuildInputs = with python3Packages; [
setuptools
filetype
cairosvg
pillow
pynput
pyside2
streamdeck
xlib
];
checkInputs = [
xvfb-run
python3Packages.pytest
python3Packages.hypothesis-auto
];
# 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
'';
meta = with lib; {
description = "Linux compatible UI for the Elgato Stream Deck";
homepage = "https://timothycrosley.github.io/streamdeck-ui/";
license = licenses.mit;
maintainers = with maintainers; [ majiir ];
};
}

View File

@ -24,14 +24,22 @@ stdenv.mkDerivation rec {
];
nativeBuildInputs = [ cmake ninja qt5.qmake python ];
buildInputs = with qt5; [
buildInputs = (with qt5; [
qtbase qtxmlpatterns qtmultimedia qttools qtx11extras qtlocation qtscript
qtwebsockets qtwebengine qtwebchannel qtcharts qtsensors qtsvg
]) ++ [
python.pkgs.setuptools
];
propagatedBuildInputs = [ shiboken2 ];
dontWrapQtApps = true;
postInstall = ''
cd ../../..
${python.interpreter} setup.py egg_info --build-type=pyside2
cp -r PySide2.egg-info $out/${python.sitePackages}/
'';
meta = with lib; {
description = "LGPL-licensed Python bindings for Qt";
license = licenses.lgpl21;

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation {
CLANG_INSTALL_DIR = llvmPackages.libclang.out;
nativeBuildInputs = [ cmake ];
buildInputs = [ llvmPackages.libclang python qt5.qtbase qt5.qtxmlpatterns ];
buildInputs = [ llvmPackages.libclang python python.pkgs.setuptools qt5.qtbase qt5.qtxmlpatterns ];
cmakeFlags = [
"-DBUILD_TESTS=OFF"
@ -26,6 +26,9 @@ stdenv.mkDerivation {
dontWrapQtApps = true;
postInstall = ''
cd ../../..
${python.interpreter} setup.py egg_info --build-type=shiboken2
cp -r shiboken2.egg-info $out/${python.sitePackages}/
rm $out/bin/shiboken_tool.py
'';

View File

@ -0,0 +1,36 @@
{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, substituteAll
, pkgs
}:
buildPythonPackage rec {
pname = "streamdeck";
version = "0.9.1";
src = fetchPypi {
inherit pname version;
sha256 = "0116a376afc18f3abbf79cc1a4409f81472e19197d5641b9e97e697d105cbdc0";
};
patches = [
# substitute libusb path
(substituteAll {
src = ./hardcode-libusb.patch;
libusb = "${pkgs.hidapi}/lib/libhidapi-libusb${stdenv.hostPlatform.extensions.sharedLibrary}";
})
];
pythonImportsCheck = [ "StreamDeck" ];
doCheck = false;
meta = with lib; {
description = "Python library to control the Elgato Stream Deck";
homepage = "https://github.com/abcminiuser/python-elgato-streamdeck";
license = licenses.mit;
maintainers = with maintainers; [ majiir ];
broken = stdenv.isDarwin;
};
}

View File

@ -0,0 +1,13 @@
diff --git a/src/StreamDeck/Transport/LibUSBHIDAPI.py b/src/StreamDeck/Transport/LibUSBHIDAPI.py
index 824c59c..f13754e 100644
--- a/src/StreamDeck/Transport/LibUSBHIDAPI.py
+++ b/src/StreamDeck/Transport/LibUSBHIDAPI.py
@@ -110,7 +110,7 @@ class LibUSBHIDAPI(Transport):
search_library_names = {
"Windows": ["hidapi.dll", "libhidapi-0.dll"],
- "Linux": ["libhidapi-libusb.so", "libhidapi-libusb.so.0"],
+ "Linux": ["@libusb@"],
"Darwin": ["libhidapi.dylib"],
}

View File

@ -22,6 +22,10 @@ buildPythonPackage rec {
sha256 = "155p9xhsk01z9vdml74h07svlqy6gljnx9c6qbydcr14lwghwn06";
};
patches = [
./fix-no-protocol-specified.patch
];
nativeBuildInputs = [ setuptools-scm ];
buildInputs = [ xorg.libX11 ];
propagatedBuildInputs = [ six ];

View File

@ -0,0 +1,13 @@
diff --git a/Xlib/xauth.py b/Xlib/xauth.py
index 2ed7dd5..303bd49 100644
--- a/Xlib/xauth.py
+++ b/Xlib/xauth.py
@@ -120,6 +120,8 @@ class Xauthority(object):
matches = {}
for efam, eaddr, enum, ename, edata in self.entries:
+ if enum == b'' and ename not in matches:
+ enum = num
if efam == family and eaddr == address and num == enum:
matches[ename] = edata

View File

@ -27679,6 +27679,8 @@ with pkgs;
srain = callPackage ../applications/networking/irc/srain { };
streamdeck-ui = libsForQt5.callPackage ../applications/misc/streamdeck-ui { };
super-productivity = callPackage ../applications/office/super-productivity {
electron = electron_17;
};

View File

@ -10252,6 +10252,8 @@ in {
stravalib = callPackage ../development/python-modules/stravalib { };
streamdeck = callPackage ../development/python-modules/streamdeck { };
streaming-form-data = callPackage ../development/python-modules/streaming-form-data { };
streamlabswater = callPackage ../development/python-modules/streamlabswater { };