diff --git a/flake.lock b/flake.lock index de91911..dd2c395 100644 --- a/flake.lock +++ b/flake.lock @@ -1435,6 +1435,22 @@ "type": "github" } }, + "nixpkgs-streamcontroller": { + "locked": { + "lastModified": 1724014496, + "narHash": "sha256-2+fJJtJ2BEkiIUl//7ysrMRW/whuw4/oX/xL/CFfSDM=", + "owner": "sifmelcara", + "repo": "nixpkgs", + "rev": "1e6aa887f401957d4d3fd01934e6e176eea9aa9a", + "type": "github" + }, + "original": { + "owner": "sifmelcara", + "ref": "streamcontroller", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-wayland": { "inputs": { "flake-compat": "flake-compat_5", @@ -1714,6 +1730,7 @@ "nixos-nftables-firewall": "nixos-nftables-firewall", "nixpkgs": "nixpkgs_2", "nixpkgs-octoprint": "nixpkgs-octoprint", + "nixpkgs-streamcontroller": "nixpkgs-streamcontroller", "nixpkgs-wayland": "nixpkgs-wayland", "nixvim": "nixvim", "pre-commit-hooks": "pre-commit-hooks_4", diff --git a/flake.nix b/flake.nix index b136240..46332af 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,7 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-octoprint.url = "github:patrickdag/nixpkgs/octoprint-update"; + nixpkgs-streamcontroller.url = "github:sifmelcara/nixpkgs/streamcontroller"; nixpkgs-wayland = { url = "github:nix-community/nixpkgs-wayland"; diff --git a/nix/hosts.nix b/nix/hosts.nix index 2bed07b..1b825b9 100644 --- a/nix/hosts.nix +++ b/nix/hosts.nix @@ -35,7 +35,7 @@ # So we just mimic the options and overlays defined by the passed pkgs set. node.name = name; node.secretsDir = ../. + "/hosts/${name}/secrets"; - nixpkgs.overlays = (import ../pkgs) ++ [ + nixpkgs.overlays = (import ../pkgs inputs) ++ [ # nixpkgs-wayland.overlay inputs.nixos-extra-modules.overlays.default inputs.nix-topology.overlays.default diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 877827b..ece44a1 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -17,7 +17,7 @@ _module.args.pkgs = import inputs.nixpkgs { inherit system; config.allowUnfree = true; - overlays = (import ../pkgs/default.nix) ++ [ + overlays = (import ../pkgs inputs) ++ [ inputs.nix-topology.overlays.default inputs.nixos-extra-modules.overlays.default ]; diff --git a/pkgs/default.nix b/pkgs/default.nix index b989b15..78c7d85 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,4 +1,4 @@ -[ +inputs: [ (import ./scripts) (_final: prev: { zsh-histdb-skim = prev.callPackage ./zsh-histdb-skim.nix { }; @@ -10,6 +10,9 @@ minion = prev.callPackage ./minion.nix { }; mongodb-bin = prev.callPackage ./mongodb-bin.nix { }; awakened-poe-trade = prev.callPackage ./awakened-poe-trade.nix { }; + streamcontroller = + prev.callPackage "${inputs.nixpgkgs-streamcontroller}/pkgs/by-name/st/streamcontroller/package.nix" + { }; neovim-clean = prev.neovim-unwrapped.overrideAttrs ( _neovimFinal: neovimPrev: { nativeBuildInputs = (neovimPrev.nativeBuildInputs or [ ]) ++ [ prev.makeWrapper ]; @@ -49,7 +52,12 @@ ); kanidm-provision = prev.callPackage ./kanidm-provision.nix { }; pythonPackagesExtension = prev.pythonPackagesExtension ++ [ - (_pythonFinal: pythonPrev: { usb-monitor = pythonPrev.callPackage ./usb-monitor.nix { }; }) + (_pythonFinal: pythonPrev: { + usb-monitor = + pythonPrev.callPackage + "${inputs.nixpkgs-streamcontroller}/pkgs/development/python-modules/usb-monitor/default.nix" + { }; + }) ]; }) ] diff --git a/pkgs/streamcontroller.nix b/pkgs/streamcontroller.nix deleted file mode 100644 index fbb5083..0000000 --- a/pkgs/streamcontroller.nix +++ /dev/null @@ -1,218 +0,0 @@ -{ - 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; - }; -} diff --git a/pkgs/usb-monitor.nix b/pkgs/usb-monitor.nix deleted file mode 100644 index d47166b..0000000 --- a/pkgs/usb-monitor.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - 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; - }; -}