From ffaf192563dec6b8d071f24369df6f4fcf482238 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Wed, 11 May 2022 15:24:14 +0200 Subject: [PATCH] input-remapper: Remove as it is upstream --- hosts/miku.nix | 5 +- modules/services/input-remapper/default.nix | 31 +++----- packages/default.nix | 1 - .../games/input-remapper/add-scripts.patch | 17 ----- .../tools/games/input-remapper/default.nix | 74 ------------------- .../games/input-remapper/hack-data-dir.patch | 12 --- 6 files changed, 13 insertions(+), 127 deletions(-) delete mode 100644 packages/tools/games/input-remapper/add-scripts.patch delete mode 100644 packages/tools/games/input-remapper/default.nix delete mode 100644 packages/tools/games/input-remapper/hack-data-dir.patch diff --git a/hosts/miku.nix b/hosts/miku.nix index 09a5846..1276708 100644 --- a/hosts/miku.nix +++ b/hosts/miku.nix @@ -81,7 +81,7 @@ gamemode.enable = true; gnome.enable = true; input-remapper = { - enable = false; + enable = true; postStartCommand = "${pkgs.input-remapper}/bin/input-remapper-control --command start --preset NOOP --device \"Razer Razer Tartarus V2\""; }; gdm = { @@ -111,7 +111,8 @@ #podman = { # enable = true; # dockerCompat = true; - #}; + #}; + docker.enable = true; }; boot = let diff --git a/modules/services/input-remapper/default.nix b/modules/services/input-remapper/default.nix index f5d8fb3..3127169 100644 --- a/modules/services/input-remapper/default.nix +++ b/modules/services/input-remapper/default.nix @@ -14,27 +14,16 @@ in { config = lib.mkIf cfg.enable { # TODO: Assert that uinput is in kernelModules - services.udev = { - packages = with pkgs; [ input-remapper ]; - extraRules = '' - KERNEL=="uinput", GROUP="input", MODE="0660" - ''; - }; - - environment.systemPackages = [ - pkgs.input-remapper # Custom package - ]; - - 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.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 - ExecStartPost = cfg.postStartCommand; - }; + #services.udev = { + # packages = with pkgs; [ input-remapper ]; + # extraRules = '' + # KERNEL=="uinput", GROUP="input", MODE="0660" + # ''; + #}; + services.input-remapper = { + enable = true; + enableUdevRules = true; + serviceWantedBy = [ "default.target" ]; }; }; } diff --git a/packages/default.nix b/packages/default.nix index b89b014..eb220fd 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -13,7 +13,6 @@ let in { inherit discord-system-electron; - 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 // { diff --git a/packages/tools/games/input-remapper/add-scripts.patch b/packages/tools/games/input-remapper/add-scripts.patch deleted file mode 100644 index 18b5627..0000000 --- a/packages/tools/games/input-remapper/add-scripts.patch +++ /dev/null @@ -1,17 +0,0 @@ -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", diff --git a/packages/tools/games/input-remapper/default.nix b/packages/tools/games/input-remapper/default.nix deleted file mode 100644 index 7752e1a..0000000 --- a/packages/tools/games/input-remapper/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ - pkgs, lib -, python3Packages, python3 -, gtk3, gobject-introspection, git, gnome, gtksourceview4 -, wrapGAppsHook -, makeDesktopItem -, fetchFromGitHub -}: - -python3Packages.buildPythonApplication rec { - pname = "input-remapper"; - version = "1.4.0"; - - buildInputs = [ gobject-introspection gtk3 gnome.adwaita-icon-theme gtksourceview4 ]; - - nativeBuildInputs = [ wrapGAppsHook ]; - - propagatedBuildInputs = with python3.pkgs; [ setuptools pydbus evdev pygobject3 ]; - - src = fetchFromGitHub { - owner = "sezanzeb"; - repo = "input-remapper"; - rev = version; - sha256 = "0h64cblpfz2zk15r2ja1kww1cw54gywmfr1zc16qx7sbjy0yi8px"; - }; - - doCheck = false; - strictDeps = false; - - patches = [ - ./add-scripts.patch - ./hack-data-dir.patch - ]; - - # Fix input-remapper not finding its data files - preBuild = '' - 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 - # correctly - preInstall = '' - # see https://github.com/pypa/setuptools/issues/130 - ${python3}/bin/${python3.executable} setup.py install_data --install-dir=$out --root=$out - ''; - - postInstall = '' - # Install the udev rules - mkdir -p $out/lib/udev/rules.d - 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/input-remapper/input-remapper.svg $out/share/icons/hicolor/scalable/apps/input-remapper.svg - ''; - - desktopItem = makeDesktopItem { - name = "input-remapper"; - exec = "input-remapper-gtk"; - icon = "input-remapper"; - desktopName = "input-remapper"; - genericName = "input-remapper"; - }; - - meta = with lib; { - homepage = "https://github.com/sezanzeb/input-remapper"; - description = "A tool to change the mapping of your input device buttons"; - license = licenses.gpl3; - maintainers = [ ]; - platforms = lib.platforms.linux; - }; -} diff --git a/packages/tools/games/input-remapper/hack-data-dir.patch b/packages/tools/games/input-remapper/hack-data-dir.patch deleted file mode 100644 index af28660..0000000 --- a/packages/tools/games/input-remapper/hack-data-dir.patch +++ /dev/null @@ -1,12 +0,0 @@ -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: