diff --git a/packages/key-mapper/default.nix b/packages/key-mapper/default.nix index 7a843a8..ff06d6f 100644 --- a/packages/key-mapper/default.nix +++ b/packages/key-mapper/default.nix @@ -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,12 +23,25 @@ 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 = '' # 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"; diff --git a/packages/key-mapper/hack-data-dir.patch b/packages/key-mapper/hack-data-dir.patch index 75f1d99..65d3b2f 100644 --- a/packages/key-mapper/hack-data-dir.patch +++ b/packages/key-mapper/hack-data-dir.patch @@ -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: