key-mapper: Hack the derivation path more cleanly

This commit is contained in:
PapaTutuWawa 2021-08-22 21:56:58 +02:00
parent d8189c1b89
commit 44b9e944c5
2 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,4 @@
{ pkgs, lib, python3Packages, python3, gtk3, gobject-introspection, git, wrapGAppsHook, gnome }:
{ pkgs, lib, python3Packages, python3, gtk3, gobject-introspection, git, wrapGAppsHook, gnome, makeDesktopItem }:
python3Packages.buildPythonApplication rec {
pname = "key-mapper";
@ -23,6 +23,11 @@ python3Packages.buildPythonApplication rec {
./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 = ''
@ -30,6 +35,14 @@ python3Packages.buildPythonApplication rec {
${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";

View File

@ -1,12 +1,12 @@
diff --git a/keymapper/data.py b/keymapper/data.py
index d909399..f7716ac 100644
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'),
+ os.environ["KEYMAPPER_DATA"],
+ 'NIXOS_OUT_PATH',
]
if data is None: