From d1d8d02beace5b5124502f64ffa274719a737b72 Mon Sep 17 00:00:00 2001 From: Ming-Chuan Date: Sat, 17 Aug 2024 22:43:41 -0700 Subject: [PATCH] streamcontroller: init at 1.5.0-beta.6-unstable-2024-08-13 --- pkgs/by-name/st/streamcontroller/package.nix | 190 ++++++++++++++++++ .../streamcontroller-plugin-tools/default.nix | 33 +++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 225 insertions(+) create mode 100644 pkgs/by-name/st/streamcontroller/package.nix create mode 100644 pkgs/development/python-modules/streamcontroller-plugin-tools/default.nix diff --git a/pkgs/by-name/st/streamcontroller/package.nix b/pkgs/by-name/st/streamcontroller/package.nix new file mode 100644 index 000000000000..830bc1229052 --- /dev/null +++ b/pkgs/by-name/st/streamcontroller/package.nix @@ -0,0 +1,190 @@ +{ + stdenv, + lib, + python3Packages, + fetchFromGitHub, + copyDesktopItems, + makeDesktopItem, + wrapGAppsHook4, + gobject-introspection, + libadwaita, + libportal, + libportal-gtk4, + xdg-desktop-portal, + xdg-desktop-portal-gtk, +}: +stdenv.mkDerivation rec { + pname = "streamcontroller"; + + # Note that the latest tagged version (1.5.0-beta.6) includes a python dependency + # that doesn't exist anymore, so we package an unstable version instead. + version = "1.5.0-beta.6-unstable-2024-08-13"; + + src = fetchFromGitHub { + repo = "StreamController"; + owner = "StreamController"; + rev = "dbb6460a69137af192db09d504224ae9f1127cbd"; + hash = "sha256-+YYzHLRU5MNjF3iaKIDj9k4PVg+vnEZhbc3ZmNI7xyw="; + }; + + # The installation method documented upstream + # (https://streamcontroller.github.io/docs/latest/installation/) is to clone the repo, + # run `pip install`, then run `python3 main.py` to launch the program. + # Due to how the code is structured upstream, it's infeasible to use `buildPythonApplication`. + + dontBuild = true; + installPhase = '' + runHook preInstall + + mkdir -p $out/usr/lib/streamcontroller + cp -r ./* $out/usr/lib/streamcontroller/ + + mkdir -p $out/bin/ + + # Note that the implementation of main.py assumes + # working directory to be at the root of the project's source code + makeWrapper \ + ${python3Packages.python.interpreter} \ + $out/bin/streamcontroller \ + --add-flags main.py \ + --chdir $out/usr/lib/streamcontroller \ + --prefix PYTHONPATH : "$PYTHONPATH" + + mkdir -p "$out/etc/udev/rules.d" + cp ./udev.rules $out/etc/udev/rules.d/70-streamcontroller.rules + + install -D ./flatpak/icon_256.png $out/share/icons/hicolor/256x256/apps/streamcontroller.png + + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { + name = "StreamController"; + desktopName = "StreamController"; + exec = "streamcontroller"; + icon = "streamcontroller"; + comment = "Control your Elgato Stream Decks"; + categories = [ "Utility" ]; + }) + ]; + + nativeBuildInputs = [ + copyDesktopItems + wrapGAppsHook4 + gobject-introspection + ]; + + buildInputs = + [ + libadwaita + libportal + libportal-gtk4 + xdg-desktop-portal + xdg-desktop-portal-gtk + ] + ++ (with python3Packages; [ + annotated-types + async-lru + cairocffi + cairosvg + certifi + cffi + charset-normalizer + click + colorama + contourpy + cssselect2 + cycler + dbus-python + decorator + defusedxml + distlib + dnspython + evdev + filelock + fonttools + fuzzywuzzy + gcodepy + get-video-properties + gitdb + idna + imageio + imageio-ffmpeg + indexed-bzip2 + jinja2 + joblib + kiwisolver + levenshtein + linkify-it-py + loguru + markdown-it-py + markupsafe + matplotlib + mdit-py-plugins + mdurl + meson + meson-python + natsort + nltk + numpy + opencv4 + packaging + pillow + platformdirs + plumbum + proglog + psutil + pulsectl + pycairo + pyclip + pycparser + pydantic + pydantic-core + pyenchant + pygments + pygobject3 + pymongo + pyparsing + pyperclip + pyproject-metadata + pyro5 + pyspellchecker + python-dateutil + pyudev + pyusb + pyyaml + rapidfuzz + regex + requests + requirements-parser + rich + rpyc + serpent + setproctitle + six + smmap + speedtest-cli + streamcontroller-plugin-tools + streamdeck + textual + tinycss2 + tqdm + types-setuptools + typing-extensions + uc-micro-py + urllib3 + usb-monitor + webencodings + websocket-client + ]); + + meta = with lib; { + description = "Elegant Linux app for the Elgato Stream Deck with support for plugins"; + homepage = "https://core447.com/"; + license = licenses.gpl3; + mainProgram = "streamcontroller"; + maintainers = with maintainers; [ sifmelcara ]; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs/development/python-modules/streamcontroller-plugin-tools/default.nix b/pkgs/development/python-modules/streamcontroller-plugin-tools/default.nix new file mode 100644 index 000000000000..1375f6eae785 --- /dev/null +++ b/pkgs/development/python-modules/streamcontroller-plugin-tools/default.nix @@ -0,0 +1,33 @@ +{ + buildPythonPackage, + fetchFromGitHub, + lib, + loguru, + rpyc, +}: +buildPythonPackage rec { + pname = "streamcontroller-plugin-tools"; + version = "2.0.0"; + + src = fetchFromGitHub { + owner = "StreamController"; + repo = "streamcontroller-plugin-tools"; + rev = version; + hash = "sha256-dQZPRSzHhI3X+Pf7miwJlECGFgUfp68PtvwXAmpq5/s="; + }; + + dependencies = [ + loguru + rpyc + ]; + + pythonImportsCheck = [ "streamcontroller_plugin_tools" ]; + + meta = with lib; { + description = "StreamController plugin tools"; + homepage = "https://github.com/StreamController/streamcontroller-plugin-tools"; + license = licenses.gpl3; + maintainers = with maintainers; [ sifmelcara ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a7c786aac645..0b33172ecf20 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15152,6 +15152,8 @@ self: super: with self; { strct = callPackage ../development/python-modules/strct { }; + streamcontroller-plugin-tools = callPackage ../development/python-modules/streamcontroller-plugin-tools { }; + streamdeck = callPackage ../development/python-modules/streamdeck { }; streaming-form-data = callPackage ../development/python-modules/streaming-form-data { };