feat: add streamdeck succesor

This commit is contained in:
Patrick 2024-08-19 15:45:08 +02:00
parent 8d9f96fff5
commit f77b8a5fda
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
5 changed files with 276 additions and 18 deletions

View file

@ -1,4 +1,9 @@
{ inputs, lib, ... }: {
inputs,
lib,
pkgs,
...
}:
{ {
imports = [ imports = [
inputs.nixos-hardware.nixosModules.common-gpu-nvidia-nonprime inputs.nixos-hardware.nixosModules.common-gpu-nvidia-nonprime
@ -73,4 +78,7 @@
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
nixpkgs.config.cudaSupport = true; nixpkgs.config.cudaSupport = true;
environment.systemPackages = [ pkgs.streamlink ];
services.udev.packages = [ pkgs.streamlink ];
} }

View file

@ -1,18 +1,18 @@
[ [
(import ./scripts) (import ./scripts)
(_prev: final: { (_final: prev: {
zsh-histdb-skim = final.callPackage ./zsh-histdb-skim.nix { }; zsh-histdb-skim = prev.callPackage ./zsh-histdb-skim.nix { };
zsh-histdb = final.callPackage ./zsh-histdb.nix { }; zsh-histdb = prev.callPackage ./zsh-histdb.nix { };
actual = final.callPackage ./actual.nix { }; actual = prev.callPackage ./actual.nix { };
pr-tracker = final.callPackage ./pr-tracker.nix { }; pr-tracker = prev.callPackage ./pr-tracker.nix { };
homebox = final.callPackage ./homebox.nix { }; homebox = prev.callPackage ./homebox.nix { };
deploy = final.callPackage ./deploy.nix { }; deploy = prev.callPackage ./deploy.nix { };
minion = final.callPackage ./minion.nix { }; minion = prev.callPackage ./minion.nix { };
mongodb-bin = final.callPackage ./mongodb-bin.nix { }; mongodb-bin = prev.callPackage ./mongodb-bin.nix { };
awakened-poe-trade = final.callPackage ./awakened-poe-trade.nix { }; awakened-poe-trade = prev.callPackage ./awakened-poe-trade.nix { };
neovim-clean = final.neovim-unwrapped.overrideAttrs ( neovim-clean = prev.neovim-unwrapped.overrideAttrs (
_neovimFinal: neovimPrev: { _neovimFinal: neovimPrev: {
nativeBuildInputs = (neovimPrev.nativeBuildInputs or [ ]) ++ [ final.makeWrapper ]; nativeBuildInputs = (neovimPrev.nativeBuildInputs or [ ]) ++ [ prev.makeWrapper ];
postInstall = postInstall =
(neovimPrev.postInstall or "") (neovimPrev.postInstall or "")
+ '' + ''
@ -20,7 +20,7 @@
''; '';
} }
); );
path-of-building = final.path-of-building.overrideAttrs (old: { path-of-building = prev.path-of-building.overrideAttrs (old: {
postFixup = postFixup =
(old.postFixup or "") (old.postFixup or "")
+ '' + ''
@ -28,10 +28,10 @@
--set QT_QPA_PLATFORM xcb --set QT_QPA_PLATFORM xcb
''; '';
}); });
kanidm = final.kanidm.overrideAttrs ( kanidm = prev.kanidm.overrideAttrs (
old: old:
let let
provisionSrc = final.fetchFromGitHub { provisionSrc = prev.fetchFromGitHub {
owner = "oddlama"; owner = "oddlama";
repo = "kanidm-provision"; repo = "kanidm-provision";
rev = "v1.1.0"; rev = "v1.1.0";
@ -47,6 +47,9 @@
doCheck = false; doCheck = false;
} }
); );
kanidm-provision = final.callPackage ./kanidm-provision.nix { }; kanidm-provision = prev.callPackage ./kanidm-provision.nix { };
pythonPackagesExtension = prev.pythonPackagesExtension ++ [
(_pythonFinal: pythonPrev: { usb-monitor = pythonPrev.callPackage ./usb-monitor.nix { }; })
];
}) })
] ]

218
pkgs/streamcontroller.nix Normal file
View file

@ -0,0 +1,218 @@
{
stdenv,
lib,
python3Packages,
fetchFromGitHub,
copyDesktopItems,
makeDesktopItem,
wrapGAppsHook4,
gobject-introspection,
libadwaita,
libportal,
libportal-gtk4,
xdg-desktop-portal,
xdg-desktop-portal-gtk,
}:
let
streamcontroller-plugin-tools = python3Packages.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 = with python3Packages; [
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 = lib.platforms.linux;
};
};
in
stdenv.mkDerivation rec {
name = "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 = "0-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/bin/
cat << EOF > $out/bin/streamcontroller
#!/usr/bin/env bash
# Note that the implementation of main.py assumes
# working directory to be at the root of the project's source code
cd ${src}
${python3Packages.python}/bin/python main.py
EOF
chmod +x $out/bin/streamcontroller
wrapProgram $out/bin/streamcontroller --prefix PYTHONPATH : "$PYTHONPATH"
# Install udev rules
mkdir -p "$out/etc/udev/rules.d"
cp ${src}/udev.rules $out/etc/udev/rules.d/70-streamcontroller.rules
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "StreamController";
desktopName = "StreamController";
exec = "streamcontroller";
icon = "${src}/flatpak/icon_256.png";
categories = [ "Application" ];
})
];
nativeBuildInputs = [
copyDesktopItems
wrapGAppsHook4
];
buildInputs =
[
gobject-introspection
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
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 = "An 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;
};
}

29
pkgs/usb-monitor.nix Normal file
View file

@ -0,0 +1,29 @@
{
buildPythonPackage,
fetchPypi,
lib,
python3Packages,
}:
buildPythonPackage rec {
pname = "usb-monitor";
version = "1.21";
src = fetchPypi {
inherit version;
pname = "usb_monitor";
hash = "sha256-M+BUmbNxQWcULFECexTnp55EZiJ6y3bYCEtSwqKldAk=";
};
dependencies = [ python3Packages.pyudev ];
pythonImportsCheck = [ "usbmonitor" ];
meta = {
description = "Cross-platform library for USB device monitoring";
homepage = "https://github.com/Eric-Canas/USBMonitor";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ sifmelcara ];
platforms = lib.platforms.linux;
};
}

View file

@ -1,7 +1,7 @@
{ config, ... }: { config, ... }:
{ {
programs.streamdeck-ui = { programs.streamdeck-ui = {
enable = true; #enable = true;
settings = { settings = {
# Device ID # Device ID
"AL31H1B01852" = { "AL31H1B01852" = {