packages: Add packages

- Add iptsd
- Add gamemode
- Add key-mapper
- Add replaysorcery
- Add surface-control
- Add vfio-isolate
This commit is contained in:
PapaTutuWawa 2021-09-03 14:50:30 +02:00
parent 9d058f5bb4
commit 77eed6e97f
12 changed files with 363 additions and 0 deletions

View File

@ -0,0 +1,42 @@
{
stdenv, lib
, fetchFromGitHub
, meson, cmake, ninja, pkg-config
, inih, systemd
}:
stdenv.mkDerivation rec {
pname = "iptsd";
version = "0.4";
src = fetchFromGitHub {
owner = "linux-surface";
repo = pname;
rev = "v${version}";
sha256 = "0bh7rr37yck82g41dw2xcfkmyp1ncd27n1slb8xlknp7vs9f10qa";
};
mesonFlags = [
"-Dsample_config=false"
"-Ddebug_tool=false"
];
patches = [
./meson.patch
];
postPatch = ''
sed -e "s|@UDEVRULESDIR@|$out/lib/udev/rules.d/|" --in-place meson.build
'';
nativeBuildInputs = [ meson cmake ninja pkg-config ];
buildInputs = [ inih systemd ];
meta = with lib; {
homepage = "https://github.com/linux-surface/iptsd";
description = "Userspace daemon for Intel Precise Touch & Stylus";
license = licenses.gpl2;
maintainers = [];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,32 @@
diff --git a/meson.build b/meson.build
index b74a177..ca41ba3 100644
--- a/meson.build
+++ b/meson.build
@@ -104,18 +104,19 @@ configure_file(
service_manager = get_option('service_manager')
if service_manager.contains('systemd')
systemd = dependency('systemd')
- unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+ #unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
udev = dependency('udev')
- udevdir = udev.get_pkgconfig_variable('udevdir')
- rulesdir = join_paths(udevdir, 'rules.d')
+ #udevdir = udev.get_pkgconfig_variable('udevdir')
+ #udevdir = '@UDEVDIR@';
+ #rulesdir = join_paths('@UDEVDIR@', 'rules.d')
- install_data(
- join_paths(meson.current_build_dir(), 'iptsd.service'),
- install_dir: unitdir
- )
+########install_data(
+######## join_paths(meson.current_build_dir(), 'iptsd.service'),
+######## install_dir: unitdir
+########)
- install_data('etc/udev/50-ipts.rules', install_dir: rulesdir)
+ install_data('etc/udev/50-ipts.rules', install_dir: '@UDEVRULESDIR@')
endif
if service_manager.contains('openrc')

View File

@ -0,0 +1,50 @@
{ 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

@ -0,0 +1,12 @@
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

@ -0,0 +1,17 @@
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

@ -0,0 +1,53 @@
{ 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

@ -0,0 +1,12 @@
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

@ -0,0 +1,39 @@
{ 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

@ -0,0 +1,18 @@
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

@ -0,0 +1,38 @@
{
lib
, fetchFromGitHub
, rustPlatform
, pkg-config, udev
}:
rustPlatform.buildRustPackage rec {
pname = "surface-control";
version = "0.4.1-1";
src = fetchFromGitHub {
owner = "linux-surface";
repo = "surface-control";
rev = "v${version}";
sha256 = "0606imcz38kcfxcjs00j3va7j7i8fzr4mcspyh5d6jrwwgl1xjxb";
};
cargoSha256 = "1yqwaba1rkm3kw1py87j23q4jbdhdsx6fmqidzxgqhr7awrq763y";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ udev ];
postInstall = ''
mkdir -p $out/lib/udev/rules.d/
cp etc/udev/40-surface-control.rules $out/lib/udev/rules.d/40-surface-control.rules
'';
doCheck = false;
meta = with lib; {
description = "Control various aspects of Microsoft Surface devices on Linux from the Command-Line.";
homepage = "https://github.com/linux-surface/surface-control";
license = licenses.mit;
maintainers = [];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,33 @@
{ 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

@ -0,0 +1,17 @@
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',