2021-09-06 13:43:55 +00:00
|
|
|
{
|
|
|
|
pkgs, lib
|
|
|
|
, python3Packages, python3
|
2022-02-02 14:55:38 +00:00
|
|
|
, gtk3, gobject-introspection, git, gnome, gtksourceview4
|
2021-09-06 13:43:55 +00:00
|
|
|
, wrapGAppsHook
|
|
|
|
, makeDesktopItem
|
2021-11-01 21:12:21 +00:00
|
|
|
, fetchFromGitHub
|
2021-09-06 13:43:55 +00:00
|
|
|
}:
|
2021-09-03 12:50:30 +00:00
|
|
|
|
|
|
|
python3Packages.buildPythonApplication rec {
|
2022-02-02 14:55:38 +00:00
|
|
|
pname = "input-remapper";
|
|
|
|
version = "1.4.0";
|
2021-09-03 12:50:30 +00:00
|
|
|
|
2022-02-02 14:55:38 +00:00
|
|
|
buildInputs = [ gobject-introspection gtk3 gnome.adwaita-icon-theme gtksourceview4 ];
|
2021-09-03 12:50:30 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ wrapGAppsHook ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3.pkgs; [ setuptools pydbus evdev pygobject3 ];
|
|
|
|
|
2021-11-01 21:12:21 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sezanzeb";
|
2022-02-02 14:55:38 +00:00
|
|
|
repo = "input-remapper";
|
2021-11-01 21:12:21 +00:00
|
|
|
rev = version;
|
2022-02-02 14:55:38 +00:00
|
|
|
sha256 = "0h64cblpfz2zk15r2ja1kww1cw54gywmfr1zc16qx7sbjy0yi8px";
|
2021-09-03 12:50:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
strictDeps = false;
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./add-scripts.patch
|
|
|
|
./hack-data-dir.patch
|
|
|
|
];
|
|
|
|
|
2022-02-02 14:55:38 +00:00
|
|
|
# Fix input-remapper not finding its data files
|
2021-09-03 12:50:30 +00:00
|
|
|
preBuild = ''
|
2022-02-02 14:55:38 +00:00
|
|
|
sed -e "s|@@NIXOS_OUT_PATH@@|$out/usr/share/input-remapper|" --in-place inputremapper/data.py
|
2021-09-03 12:50:30 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
2021-09-06 13:43:55 +00:00
|
|
|
postInstall = ''
|
2021-10-18 14:07:55 +00:00
|
|
|
# Install the udev rules
|
|
|
|
mkdir -p $out/lib/udev/rules.d
|
2022-02-02 14:55:38 +00:00
|
|
|
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
|
2021-10-18 14:07:55 +00:00
|
|
|
|
|
|
|
# Install the desktop file
|
2021-09-06 13:43:55 +00:00
|
|
|
mkdir -p $out/share/icons/hicolor/scalable/apps/
|
|
|
|
cp -r ${desktopItem}/share/applications $out/share/
|
2022-02-02 14:55:38 +00:00
|
|
|
cp $out/usr/share/input-remapper/input-remapper.svg $out/share/icons/hicolor/scalable/apps/input-remapper.svg
|
2021-09-06 13:43:55 +00:00
|
|
|
'';
|
|
|
|
|
2021-09-03 12:50:30 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
2022-02-02 14:55:38 +00:00
|
|
|
name = "input-remapper";
|
|
|
|
exec = "input-remapper-gtk";
|
|
|
|
icon = "input-remapper";
|
|
|
|
desktopName = "input-remapper";
|
|
|
|
genericName = "input-remapper";
|
2021-09-03 12:50:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-02-02 14:55:38 +00:00
|
|
|
homepage = "https://github.com/sezanzeb/input-remapper";
|
2021-09-03 12:50:30 +00:00
|
|
|
description = "A tool to change the mapping of your input device buttons";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = [ ];
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|