nixos-config/packages/key-mapper/default.nix

54 lines
1.5 KiB
Nix

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