From b77d8f702c963f7a98ceba23eb2cdddc80017fb0 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Tue, 24 Aug 2021 12:02:44 +0200 Subject: [PATCH] packages: Clean up the package "repository" --- modules/programs/mpv/default.nix | 3 +- .../audio/mopidy/funkwhale.nix} | 0 packages/default.nix | 17 +-- .../notification-timeout}/default.nix | 0 packages/evdev-proxy/add-evdev-selector.patch | 101 ------------------ packages/evdev-proxy/default.nix | 34 ------ packages/gamemode/default.nix | 50 --------- .../gamemode/preload-nix-workaround.patch | 12 --- packages/key-mapper/add-scripts.patch | 17 --- packages/key-mapper/default.nix | 53 --------- packages/key-mapper/hack-data-dir.patch | 12 --- packages/{ => misc/video}/anime4k/default.nix | 0 packages/replaysorcery/default.nix | 39 ------- packages/replaysorcery/ignore-systemd.patch | 18 ---- packages/vfio-isolate/default.nix | 33 ------ packages/vfio-isolate/remove-versions.patch | 17 --- 16 files changed, 10 insertions(+), 396 deletions(-) rename packages/{mopidy-funkwhale/default.nix => applications/audio/mopidy/funkwhale.nix} (100%) rename packages/{gnomeExtensions-notification-timeout => desktop/gnome/extensions/notification-timeout}/default.nix (100%) delete mode 100644 packages/evdev-proxy/add-evdev-selector.patch delete mode 100644 packages/evdev-proxy/default.nix delete mode 100644 packages/gamemode/default.nix delete mode 100644 packages/gamemode/preload-nix-workaround.patch delete mode 100644 packages/key-mapper/add-scripts.patch delete mode 100644 packages/key-mapper/default.nix delete mode 100644 packages/key-mapper/hack-data-dir.patch rename packages/{ => misc/video}/anime4k/default.nix (100%) delete mode 100644 packages/replaysorcery/default.nix delete mode 100644 packages/replaysorcery/ignore-systemd.patch delete mode 100644 packages/vfio-isolate/default.nix delete mode 100644 packages/vfio-isolate/remove-versions.patch diff --git a/modules/programs/mpv/default.nix b/modules/programs/mpv/default.nix index fa2953b..57f642f 100644 --- a/modules/programs/mpv/default.nix +++ b/modules/programs/mpv/default.nix @@ -1,9 +1,8 @@ { config, pkgs, ... }: let - anime4k = pkgs.callPackage ../../../packages/anime4k {}; makeMpvProfile = { shader, additional ? {} }: { - glsl-shaders = "${anime4k}/usr/share/shaders/${shader}"; + glsl-shaders = "${pkgs.anime4k}/usr/share/shaders/${shader}"; scale = "ewa_lanczossharp"; cscale = "ewa_lanczossharp"; gpu-context = "wayland"; diff --git a/packages/mopidy-funkwhale/default.nix b/packages/applications/audio/mopidy/funkwhale.nix similarity index 100% rename from packages/mopidy-funkwhale/default.nix rename to packages/applications/audio/mopidy/funkwhale.nix diff --git a/packages/default.nix b/packages/default.nix index 92d6de1..c768d51 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,14 +1,15 @@ { pkgs ? import {} }: { - gamemode = pkgs.callPackage ./gamemode { }; - key-mapper = pkgs.callPackage ./key-mapper { }; - vfio-isolate = pkgs.callPackage ./vfio-isolate { }; - mopidy-funkwhale = pkgs.callPackage ./mopidy-funkwhale {}; + gamemode = pkgs.callPackage ./tools/games/gamemode { }; + key-mapper = pkgs.callPackage ./tools/games/key-mapper {}; + vfio-isolate = pkgs.callPackage ./tools/virtualisation/vfio-isolate {}; + mopidy-funkwhale = pkgs.callPackage ./applications/audio/mopidy/funkwhale.nix {}; + # Not as clean as I hoped, but it works gnomeExtensions = pkgs.gnomeExtensions // { - notification-timeout = pkgs.callPackage ./gnomeExtensions-notification-timeout {}; + notification-timeout = pkgs.callPackage ./desktop/gnome/extensions/notification-timeout {}; }; - replaysorcery = pkgs.callPackage ./replaysorcery {}; - evdev-proxy = pkgs.callPackage ./evdev-proxy {}; - anime4k = pkgs.callPackage ./anime4k {}; + replaysorcery = pkgs.callPackage ./tools/games/replaysorcery {}; + evdev-proxy = pkgs.callPackage ./tools/virtualisation/evdev-proxy {}; + anime4k = pkgs.callPackage ./misc/video/anime4k {}; } diff --git a/packages/gnomeExtensions-notification-timeout/default.nix b/packages/desktop/gnome/extensions/notification-timeout/default.nix similarity index 100% rename from packages/gnomeExtensions-notification-timeout/default.nix rename to packages/desktop/gnome/extensions/notification-timeout/default.nix diff --git a/packages/evdev-proxy/add-evdev-selector.patch b/packages/evdev-proxy/add-evdev-selector.patch deleted file mode 100644 index 58913a1..0000000 --- a/packages/evdev-proxy/add-evdev-selector.patch +++ /dev/null @@ -1,101 +0,0 @@ -diff --git a/config.toml b/config.toml -index ba11ce4..3021e89 100644 ---- a/config.toml -+++ b/config.toml -@@ -27,6 +27,8 @@ log_level = "INFO" - # on it's usb vendor:model identificator and device - # class (Mouse/Keyboard), useful for wireless devices - # with single receiver (e.g. Logitech Unifying Receiver) -+# * EVDEVClass -- Simple selector based on the PHYS udev attribute. Mainly -+# useful for use with key-mapper - # - # Example devices: - #[[device]] -diff --git a/src/config.rs b/src/config.rs -index 06ae8f5..10d7721 100644 ---- a/src/config.rs -+++ b/src/config.rs -@@ -35,6 +35,9 @@ pub enum DeviceSelector { - model: u16, - class: USBHIDClass, - }, -+ EVDEVClass{ -+ phys: String, -+ }, - } - - pub fn read_config + Debug + ToString>(path: P) -> Result { -diff --git a/src/main.rs b/src/main.rs -index 19055c7..b5c46ec 100644 ---- a/src/main.rs -+++ b/src/main.rs -@@ -21,7 +21,10 @@ fn selector_by_config(s: &config::DeviceSelector) -> Box { - Box::new(udevdetect::USBIDClassFilter::new(*vendor, *model, *class)) -- } -+ }, -+ config::DeviceSelector::EVDEVClass{phys} => { -+ Box::new(udevdetect::EVDEVFilter::new(String::from(phys))) -+ }, - } - } - -diff --git a/src/udevdetect/filter_evdev.rs b/src/udevdetect/filter_evdev.rs -new file mode 100644 -index 0000000..51dc81e ---- /dev/null -+++ b/src/udevdetect/filter_evdev.rs -@@ -0,0 +1,34 @@ -+use udev::{Device, Event}; -+ -+use crate::udevdetect::{DevFilter, get_device_property}; -+ -+#[derive(Debug)] -+pub struct EVDEVFilter { -+ phys: String, -+} -+impl EVDEVFilter { -+ pub fn new(phys: String) -> Self { -+ let f = EVDEVFilter { -+ phys: phys, -+ }; -+ debug!("New EVDEV Filter for: {:?}", f.phys); -+ f -+ } -+} -+impl DevFilter for EVDEVFilter { -+ fn match_event(&self, e: &Event) -> bool { -+ return self.match_device(&e.device()); -+ } -+ -+ fn match_device(&self, e: &Device) -> bool { -+ match e.parent() { -+ Some(parent) => { -+ if get_device_property(&parent, "PHYS") != self.phys { -+ return false -+ } -+ true -+ }, -+ None => false -+ } -+ } -+} -diff --git a/src/udevdetect/mod.rs b/src/udevdetect/mod.rs -index c2009a9..e9ed274 100644 ---- a/src/udevdetect/mod.rs -+++ b/src/udevdetect/mod.rs -@@ -9,11 +9,13 @@ pub use self::filter::DevFilter; - pub use self::filter_usbid::USBIDFilter; - pub use self::filter_usbidclass::USBIDClassFilter; - pub use self::filter_usbidclass::USBHIDClass; -+pub use self::filter_evdev::EVDEVFilter; - - mod listener; - mod filter; - mod filter_usbid; - mod filter_usbidclass; -+mod filter_evdev; - - fn get_event_property<'a>(ev: &'a Event, key: &'a str) -> &'a str { - ev.property_value(key).unwrap_or(OsStr::new("")).to_str().unwrap_or("") diff --git a/packages/evdev-proxy/default.nix b/packages/evdev-proxy/default.nix deleted file mode 100644 index 9a2bfda..0000000 --- a/packages/evdev-proxy/default.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ lib, rustPlatform, - pkgconfig, udev }: - -rustPlatform.buildRustPackage rec { - pname = "evdev-proxy"; - version = "0.1.1"; - - src = builtins.fetchGit { - url = "https://github.com/redrampage/evdev-proxy.git"; - ref = "a21092a7b52144c3bb2b630704c990cee24cb745"; - }; - - cargoSha256 = "18y3pjkiwqpwkwrn5dbkn4rdj86c96h6i2b9ih73jajlw1xli1qy"; - - patches = [ ./add-evdev-selector.patch ]; - - nativeBuildInputs = [ pkgconfig ]; - - buildInputs = [ udev ]; - - #installPhase = '' - # # Install udev rules - # mkdir -p $out/lib/udev/rules.d/ - # cp 70-uinput-evdev-proxy.rules $out/lib/udev/rules.d/70-uinput-evdev-proxy.rules - #''; - - meta = with lib; { - description = "Creates virtual device to proxy evdev devices events"; - homepage = "https://github.com/redrampage/evdev-proxy"; - license = licenses.gpl3; - maintainers = []; - platforms = platforms.linux; - }; -} diff --git a/packages/gamemode/default.nix b/packages/gamemode/default.nix deleted file mode 100644 index 8e4c460..0000000 --- a/packages/gamemode/default.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ stdenv, lib, - meson, ninja, dbus, systemd, pkgconfig, cmake, inih, - fetchFromGitHub, fetchpatch }: - -stdenv.mkDerivation rec { - pname = "gamemode"; - version = "1.6.1"; - - src = fetchFromGitHub { - owner = "FeralInteractive"; - repo = pname; - rev = version; - sha256 = "17dck7dzkmzq52f2yrs930fdg2inr7nipvnwpd0jqrwgk2fhwk9z"; - }; - - patches = [ - (fetchpatch { - url = "https://github.com/FeralInteractive/gamemode/commit/be44b7091baa33be6dda60392e4c06c2f398ee72.patch"; - sha256 = "TlDUETs4+N3pvrVd0FQGlGmC+6ByhJ2E7gKXa7suBtE="; - }) - ./preload-nix-workaround.patch - ]; - - nativeBuildInputs = [ - meson ninja pkgconfig cmake - ]; - - buildInputs = [ - dbus systemd inih - ]; - - mesonFlags = [ - "-Dwith-systemd-user-unit-dir=${placeholder "out"}/lib/systemd/user" - ]; - - postPatch = '' - substituteInPlace data/gamemoderun \ - --subst-var-by libraryPath ${lib.makeLibraryPath ([ - (placeholder "lib") - ])} - ''; - - meta = with lib; { - description = "Optimise Linux system performance on demand"; - homepage = "https://github.com/FeralInteractive/gamemode"; - license = licenses.bsd3; - maintainers = [ ]; - platforms = platforms.linux; - }; -} diff --git a/packages/gamemode/preload-nix-workaround.patch b/packages/gamemode/preload-nix-workaround.patch deleted file mode 100644 index 06989ff..0000000 --- a/packages/gamemode/preload-nix-workaround.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/data/gamemoderun b/data/gamemoderun -index 573b3e4..6f2799e 100755 ---- a/data/gamemoderun -+++ b/data/gamemoderun -@@ -5,5 +5,6 @@ GAMEMODEAUTO_NAME="libgamemodeauto.so.0" - - # ld will find the right path to load the library, including for 32-bit apps. - LD_PRELOAD="${GAMEMODEAUTO_NAME}${LD_PRELOAD:+:$LD_PRELOAD}" -+LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - --exec env LD_PRELOAD="${LD_PRELOAD}" $GAMEMODERUNEXEC "$@" -+exec env LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" $GAMEMODERUNEXEC "$@" diff --git a/packages/key-mapper/add-scripts.patch b/packages/key-mapper/add-scripts.patch deleted file mode 100644 index 364dc40..0000000 --- a/packages/key-mapper/add-scripts.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/setup.py b/setup.py -index 99d298e..74a7948 100644 ---- a/setup.py -+++ b/setup.py -@@ -107,6 +107,12 @@ setup( - ('/usr/bin/', ['bin/key-mapper-control']), - ('/usr/bin/', ['bin/key-mapper-helper']), - ], -+ scripts=[ -+ 'bin/key-mapper-gtk', -+ 'bin/key-mapper-service', -+ 'bin/key-mapper-control', -+ 'bin/key-mapper-helper' -+ ], - install_requires=[ - 'setuptools', - 'evdev', diff --git a/packages/key-mapper/default.nix b/packages/key-mapper/default.nix deleted file mode 100644 index ff06d6f..0000000 --- a/packages/key-mapper/default.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ pkgs, lib, python3Packages, python3, gtk3, gobject-introspection, git, wrapGAppsHook, gnome, makeDesktopItem }: - -python3Packages.buildPythonApplication rec { - pname = "key-mapper"; - version = "1.0.0"; - - buildInputs = [ gobject-introspection gtk3 gnome.adwaita-icon-theme ]; - - nativeBuildInputs = [ wrapGAppsHook ]; - - propagatedBuildInputs = with python3.pkgs; [ setuptools pydbus evdev pygobject3 ]; - - src = builtins.fetchGit { - url = "https://github.com/sezanzeb/key-mapper.git"; - ref = version; - }; - - doCheck = false; - strictDeps = false; - - patches = [ - ./add-scripts.patch - ./hack-data-dir.patch - ]; - - # Fix keymapper not finding its data files - preBuild = '' - sed -e "s|NIXOS_OUT_PATH|$out/usr/share/key-mapper|" --in-place keymapper/data.py - ''; - - # Required as we otherwise don't get the dbus policy installed - # correctly - preInstall = '' - # see https://github.com/pypa/setuptools/issues/130 - ${python3}/bin/${python3.executable} setup.py install_data --install-dir=$out --root=$out - ''; - - desktopItem = makeDesktopItem { - name = "key-mapper"; - exec = "$out/bin/key-mapper-gtk"; - icon = "$out/usr/share/key-mapper/key-mapper.svg"; - desktopName = "key-mapper"; - genericName = "key-mapper"; - }; - - meta = with lib; { - homepage = "https://github.com/sezanzeb/key-mapper"; - description = "A tool to change the mapping of your input device buttons"; - license = licenses.gpl3; - maintainers = [ ]; - platforms = lib.platforms.linux; - }; -} diff --git a/packages/key-mapper/hack-data-dir.patch b/packages/key-mapper/hack-data-dir.patch deleted file mode 100644 index 65d3b2f..0000000 --- a/packages/key-mapper/hack-data-dir.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/keymapper/data.py b/keymapper/data.py -index d909399..7e4aad0 100644 ---- a/keymapper/data.py -+++ b/keymapper/data.py -@@ -68,6 +68,7 @@ def get_data_path(filename=''): - '/usr/share/key-mapper', - '/usr/local/share/key-mapper', - os.path.join(site.USER_BASE, 'share/key-mapper'), -+ 'NIXOS_OUT_PATH', - ] - - if data is None: diff --git a/packages/anime4k/default.nix b/packages/misc/video/anime4k/default.nix similarity index 100% rename from packages/anime4k/default.nix rename to packages/misc/video/anime4k/default.nix diff --git a/packages/replaysorcery/default.nix b/packages/replaysorcery/default.nix deleted file mode 100644 index 7e8092c..0000000 --- a/packages/replaysorcery/default.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ stdenv, lib, - pkgconfig, cmake, ffmpeg, libdrm, libpulseaudio, xorg, libnotify, - fetchgit }: - -stdenv.mkDerivation rec { - pname = "ReplaySorcery"; - version = "0.6.0"; - - src = fetchgit { - url = "https://github.com/matanui159/${pname}.git"; - rev = "d8d5921988b5161004aed6209bd88251d721611d"; - sha256 = "14m67mlfp0zh9s0bhz1qxppivw2aignxqb51xb5cy3v8farxmcv4"; - deepClone = true; - }; - - nativeBuildInputs = [ - pkgconfig cmake - ]; - - buildInputs = [ - ffmpeg libdrm libpulseaudio xorg.libxcb xorg.libX11 - ]; - - propagatedBuildInputs = [ - libnotify - ]; - - patches = [ - ./ignore-systemd.patch - ]; - - meta = with lib; { - description = "An open-source, instant-replay solution for Linux"; - homepage = "https://github.com/matanui159/ReplaySorcery"; - license = licenses.gpl3; - maintainers = [ ]; - platforms = platforms.linux; - }; -} diff --git a/packages/replaysorcery/ignore-systemd.patch b/packages/replaysorcery/ignore-systemd.patch deleted file mode 100644 index bd07487..0000000 --- a/packages/replaysorcery/ignore-systemd.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4633f85..e3fdd7c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -213,8 +213,8 @@ install(TARGETS ${binary} DESTINATION bin PERMISSIONS ${permissions}) - install(FILES sys/replay-sorcery.conf DESTINATION etc) - - # Install services --set(RS_SYSTEMD_DIR /usr/lib/systemd CACHE STRING "Where to install the systemd services") --configure_file(sys/replay-sorcery.service.in replay-sorcery.service) --install(FILES "${CMAKE_CURRENT_BINARY_DIR}/replay-sorcery.service" DESTINATION "${RS_SYSTEMD_DIR}/user") --configure_file(sys/replay-sorcery-kms.service.in replay-sorcery-kms.service) --install(FILES "${CMAKE_CURRENT_BINARY_DIR}/replay-sorcery-kms.service" DESTINATION "${RS_SYSTEMD_DIR}/system") -+#set(RS_SYSTEMD_DIR /usr/lib/systemd CACHE STRING "Where to install the systemd services") -+#configure_file(sys/replay-sorcery.service.in replay-sorcery.service) -+#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/replay-sorcery.service" DESTINATION "${RS_SYSTEMD_DIR}/user") -+#configure_file(sys/replay-sorcery-kms.service.in replay-sorcery-kms.service) -+#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/replay-sorcery-kms.service" DESTINATION "${RS_SYSTEMD_DIR}/system") diff --git a/packages/vfio-isolate/default.nix b/packages/vfio-isolate/default.nix deleted file mode 100644 index f745642..0000000 --- a/packages/vfio-isolate/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ pkgs, lib, python3Packages, python3, gtk3, gobject-introspection, git, wrapGAppsHook, gnome }: - -python3Packages.buildPythonApplication rec { - pname = "vfio-isolate"; - version = "0.3.1"; - - buildInputs = with python3.pkgs; [ parsimonious psutil click ]; - propagatedBuildInputs = with python3.pkgs; [ parsimonious psutil click ]; - - patches = [ ./remove-versions.patch ]; - - src = builtins.fetchGit { - url = "https://github.com/spheenik/vfio-isolate.git"; - ref = "master"; - }; - - doCheck = false; - - # Required as we otherwise don't get the dbus policy installed - # correctly - #preInstall = '' - # # see https://github.com/pypa/setuptools/issues/130 - # ${python3}/bin/${python3.executable} setup.py install_data --install-dir=$out --root=$out - #''; - - meta = with lib; { - homepage = "https://github.com/spheenik/vfio-isolate"; - description = "CPU and memory isolation for VFIO "; - license = licenses.mit; - maintainers = [ ]; - platforms = lib.platforms.linux; - }; -} diff --git a/packages/vfio-isolate/remove-versions.patch b/packages/vfio-isolate/remove-versions.patch deleted file mode 100644 index 3be3e81..0000000 --- a/packages/vfio-isolate/remove-versions.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/setup.py b/setup.py -index db8db30..9f4b122 100755 ---- a/setup.py -+++ b/setup.py -@@ -29,9 +29,9 @@ setup( - ], - keywords='vfio cpu isolation', - install_requires=[ -- 'click~=7.1.2', -- 'psutil~=5.7.0', -- 'parsimonious~=0.8.1', -+ 'click', -+ 'psutil', -+ 'parsimonious', - ], - packages=find_packages(), - python_requires='>=3.6, <4',