packages: Clean up the package "repository"

This commit is contained in:
PapaTutuWawa 2021-08-24 12:02:44 +02:00
parent 669c20a354
commit b77d8f702c
16 changed files with 10 additions and 396 deletions

View File

@ -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";

View File

@ -1,14 +1,15 @@
{ pkgs ? import <nixpkgs> {} }:
{
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 {};
}

View File

@ -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<P: AsRef<Path> + Debug + ToString>(path: P) -> Result<SelfConfig, ConfigError> {
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<dyn udevdetect::DevFilt
},
config::DeviceSelector::USBIDClass{vendor, model, class} => {
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("")

View File

@ -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;
};
}

View File

@ -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;
};
}

View File

@ -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 "$@"

View File

@ -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',

View File

@ -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;
};
}

View File

@ -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:

View File

@ -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;
};
}

View File

@ -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")

View File

@ -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;
};
}

View File

@ -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',