input-remapper: Rename from key-mapper

This commit is contained in:
PapaTutuWawa 2022-02-02 15:55:38 +01:00
parent e80232bb39
commit c0b061a79d
15 changed files with 187 additions and 61 deletions

View File

@ -48,7 +48,7 @@
primaryScreen = "C27F398";
enable = true;
};
#sway.enable = true;
sway.enable = true;
alacritty.enable = true;
emacs.enable = true;
firefox.enable = true;
@ -102,8 +102,11 @@
};
};
};
#swaync.enable = true;
key-mapper.enable = true;
swaync.enable = true;
input-remapper = {
enable = true;
postStartCommand = "${pkgs.input-remapper}/bin/input-remapper-control --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0";
};
};
system = {
i18n.enable = true;
@ -170,7 +173,7 @@
services = {
ratbagd.enable = true;
flatpak.enable = true;
etesync-dav.enable = true;
#etesync-dav.enable = true;
connman.extraConfig = ''
WriteResolvConf=false
'';

View File

@ -25,7 +25,7 @@
# Services
./services/kanshi
./services/key-mapper
./services/input-remapper
./services/gamemode
./services/i18n

View File

@ -8,7 +8,7 @@ in {
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
winePackages.stagingFull winetricks
winePackages.stagingFull winetricks lutris-free-wrapped
];
};
}

View File

@ -1,34 +1,39 @@
{ config, lib, pkgs, ... }:
let
cfg = config.ptw.services.key-mapper;
cfg = config.ptw.services.input-remapper;
in {
options.ptw.services.key-mapper = {
enable = lib.mkEnableOption "Enable the key-mapper service and install it";
options.ptw.services.input-remapper = {
enable = lib.mkEnableOption "Enable the input-remapper service and install it";
postStartCommand = lib.mkOption {
default = "";
description = "Command to be executed after the input-remapper service has been started";
# type = ;
};
};
config = lib.mkIf cfg.enable {
# TODO: Assert that uinput is in kernelModules
services.udev = {
packages = with pkgs; [ key-mapper ];
packages = with pkgs; [ input-remapper ];
extraRules = ''
KERNEL=="uinput", GROUP="input", MODE="0660"
'';
};
environment.systemPackages = [
pkgs.key-mapper # Custom package
pkgs.input-remapper # Custom package
];
systemd.user.services.key-mapper = {
systemd.user.services.input-remapper = {
description = "A tool to change the mapping of your input device buttons";
wantedBy = [ "default.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.key-mapper}/bin/key-mapper-service";
ExecStart = "${pkgs.input-remapper}/bin/input-remapper-service";
Restart = "always";
# NOTE: The Tartarus may not be connected, so don't fail if we cannot set the preset
ExecPostStart = "${pkgs.key-mapper}/bin/key-mapper --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0";
ExecStartPost = cfg.postStartCommand;
};
};
};

View File

@ -64,4 +64,14 @@ in {
mountInHome = [ ".config/spotify" ];
chdirTo = "/home/$USER";
};
lutris-free-wrapped = wrapInSandbox {
name = "lutris-free";
package = prev.lutris-free;
binaryName = "lutris";
additionalBlacklist = [ "/mnt" ];
additionalMounts = [ "/mnt/Storage/Games/UPlay" ];
mountInHome = [ ".local/share/lutris" ".config/lutris" ];
chdirTo = "/home/$USER";
};
}

View File

@ -10,7 +10,7 @@ let
#extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer";
};
in {
key-mapper = prev.callPackage ./tools/games/key-mapper {};
input-remapper = prev.callPackage ./tools/games/input-remapper {};
vfio-isolate = prev.callPackage ./tools/virtualisation/vfio-isolate {};
mopidy-funkwhale = prev.callPackage ./applications/audio/mopidy/funkwhale.nix {};
python3Packages = prev.python3Packages // {

View File

@ -0,0 +1,31 @@
{
pkgs
, lib
, python3Packages
, fetchFromGitea
}:
python3Packages.buildPythonPackage rec {
pname = "keyrings.gopass";
version = "1.0.0";
src = fetchFromGitea {
domain = "git.polynom.me";
owner = "PapaTutuWawa";
repo = pname;
rev = "9c3cd59e7f5ce0a742b238ff0c4761db28344713";
sha256 = "1dg3a6zx3cm9vwsqgkmc604n3fqb760nsmnrfwyfv7y5bmh5822x";
};
nativeBuildInputs = with python3Packages; [ setuptools setuptools-scm ];
doCheck = false;
meta = with lib; {
homepage = "https://git.polynom.me/PapaTutuWawa/keyrings.gopass";
description = "A python-keyring plugin for gopass";
license = licenses.gpl3;
maintainers = [];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,17 @@
diff --git a/setup.py b/setup.py
index 1d50118..fde6119 100644
--- a/setup.py
+++ b/setup.py
@@ -129,6 +129,12 @@ setup(
("/usr/bin/", ["bin/key-mapper-service"]),
("/usr/bin/", ["bin/key-mapper-control"]),
],
+ scripts=[
+ "bin/input-remapper-gtk",
+ "bin/input-remapper-service",
+ "bin/input-remapper-control",
+ "bin/input-remapper-helper"
+ ],
install_requires=[
"setuptools",
"evdev",

View File

@ -1,17 +1,17 @@
{
pkgs, lib
, python3Packages, python3
, gtk3, gobject-introspection, git, gnome
, gtk3, gobject-introspection, git, gnome, gtksourceview4
, wrapGAppsHook
, makeDesktopItem
, fetchFromGitHub
}:
python3Packages.buildPythonApplication rec {
pname = "key-mapper";
version = "1.2.1";
pname = "input-remapper";
version = "1.4.0";
buildInputs = [ gobject-introspection gtk3 gnome.adwaita-icon-theme ];
buildInputs = [ gobject-introspection gtk3 gnome.adwaita-icon-theme gtksourceview4 ];
nativeBuildInputs = [ wrapGAppsHook ];
@ -19,9 +19,9 @@ python3Packages.buildPythonApplication rec {
src = fetchFromGitHub {
owner = "sezanzeb";
repo = "key-mapper";
repo = "input-remapper";
rev = version;
sha256 = "07dgp4vays1w4chhd22vlp9bxc49lcgzkvmjqgbr00m3781yjsf7";
sha256 = "0h64cblpfz2zk15r2ja1kww1cw54gywmfr1zc16qx7sbjy0yi8px";
};
doCheck = false;
@ -32,9 +32,9 @@ python3Packages.buildPythonApplication rec {
./hack-data-dir.patch
];
# Fix keymapper not finding its data files
# Fix input-remapper not finding its data files
preBuild = ''
sed -e "s|@@NIXOS_OUT_PATH@@|$out/usr/share/key-mapper|" --in-place keymapper/data.py
sed -e "s|@@NIXOS_OUT_PATH@@|$out/usr/share/input-remapper|" --in-place inputremapper/data.py
'';
# Required as we otherwise don't get the dbus policy installed
@ -47,25 +47,25 @@ python3Packages.buildPythonApplication rec {
postInstall = ''
# Install the udev rules
mkdir -p $out/lib/udev/rules.d
cp data/key-mapper.rules $out/lib/udev/rules.d/key-mapper.rules
sed --in-place -e "s|/bin/key-mapper-control|$out/bin/key-mapper-control|" $out/lib/udev/rules.d/key-mapper.rules
cp data/99-input-remapper.rules $out/lib/udev/rules.d/99-input-remapper.rules
sed --in-place -e "s|/bin/input-remapper-control|$out/bin/input-remapper-control|" $out/lib/udev/rules.d/99-input-remapper.rules
# Install the desktop file
mkdir -p $out/share/icons/hicolor/scalable/apps/
cp -r ${desktopItem}/share/applications $out/share/
cp $out/usr/share/key-mapper/key-mapper.svg $out/share/icons/hicolor/scalable/apps/key-mapper.svg
cp $out/usr/share/input-remapper/input-remapper.svg $out/share/icons/hicolor/scalable/apps/input-remapper.svg
'';
desktopItem = makeDesktopItem {
name = "key-mapper";
exec = "key-mapper-gtk";
icon = "key-mapper";
desktopName = "key-mapper";
genericName = "key-mapper";
name = "input-remapper";
exec = "input-remapper-gtk";
icon = "input-remapper";
desktopName = "input-remapper";
genericName = "input-remapper";
};
meta = with lib; {
homepage = "https://github.com/sezanzeb/key-mapper";
homepage = "https://github.com/sezanzeb/input-remapper";
description = "A tool to change the mapping of your input device buttons";
license = licenses.gpl3;
maintainers = [ ];

View File

@ -0,0 +1,12 @@
diff --git a/inputremapper/data.py b/inputremapper/data.py
index d5ec3a8..9fec89f 100644
--- a/inputremapper/data.py
+++ b/inputremapper/data.py
@@ -68,6 +68,7 @@ def get_data_path(filename=""):
"/usr/share/input-remapper",
"/usr/local/share/input-remapper",
os.path.join(site.USER_BASE, "share/input-remapper"),
+ "@@NIXOS_OUT_PATH@@",
]
if data is None:

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,12 +0,0 @@
diff --git a/keymapper/data.py b/keymapper/data.py
index 6f3e428..8eded95 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,62 @@
{ stdenv, lib,
pkgconfig, cmake, ffmpeg, libdrm, libpulseaudio, xorg,
libcap, wayland, libopus, boost, openssl, libevdev, mesa,
fetchgit
}:
stdenv.mkDerivation rec {
pname = "sunehine";
version = "0.10.1";
src = fetchgit {
url = "https://github.com/loki-47-6F-64/sunshine.git";
rev = "v${version}";
sha256 = "1aw8bis5v7rb3ixl378gqm34rx3sja7pp5g6kjd9b0yvl1bgxai6";
deepClone = true;
};
nativeBuildInputs = [
pkgconfig cmake
];
buildInputs = [
wayland # Wayland
libdrm libcap # KMS
xorg.libxcb xorg.libX11 xorg.libXtst xorg.libXrandr xorg.libXfixes libevdev # X11
libopus libpulseaudio boost ffmpeg openssl # Common
];
propagatedBuildInputs = [ mesa ];
cmakeFlags = [
"-DSUNSHINE_ENABLE_X11=off"
"-DSUNSHINE_ENABLE_CUDA=off"
"-DCMAKE_BUILD_TYPE=Release"
];
NIX_CFLAGS_COMPILE = "-Wformat";
patches = [ ./fuck.patch ];
preConfigure = ''
# Fix hardcoded path to libevdev
sed \
-e "s|/usr/include/libevdev-1.0|${libevdev}/include/libevdev-1.0|" \
-e "s|@@SUNSHINE_ASSETS_DIR@@|$out/share/sunshine|" \
--in-place CMakeLists.txt
'';
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share/sunshine/
cp -r ../assets $out/share/sunshine/assets
mv sunshine $out/bin/sunshine
'';
meta = with lib; {
description = "Host for Moonlight Streaming Client ";
homepage = "https://github.com/loki-47-6F-64/sunshine";
license = licenses.gpl3;
maintainers = [ ];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 45d4bf7..bd8c638 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -241,9 +241,7 @@ else()
list(APPEND SUNSHINE_COMPILE_OPTIONS -O3)
endif()
-if(NOT SUNSHINE_ASSETS_DIR)
- set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/assets")
-endif()
+set(SUNSHINE_ASSETS_DIR "@@SUNSHINE_ASSETS_DIR@@/assets")
if(NOT SUNSHINE_CONFIG_DIR)
set(SUNSHINE_CONFIG_DIR "${SUNSHINE_ASSETS_DIR}")

BIN
secrets/default.nix Normal file

Binary file not shown.