nix/overlay/Keyd.nix

41 lines
1 KiB
Nix
Raw Normal View History

2024-05-28 21:29:28 +03:00
# HACK: Add a patch for https://github.com/rvaiya/keyd/pull/545
{ lib, ... }: {
2024-05-28 14:18:25 +03:00
nixpkgs.overlays = [ (final: prev: {
2024-05-28 21:44:39 +03:00
keyd = prev.keyd.overrideAttrs (old: rec {
patches = (old.patches or []) ++ [(prev.fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/rvaiya/keyd/pull/545.patch";
hash = "sha256-aal8oAXws6DcpeCl7G9GMJQXeLDDbyotWFut0Rf82WI=";
})];
2024-05-28 21:29:28 +03:00
2024-05-28 21:44:39 +03:00
postInstall = let
pypkgs = prev.python3.pkgs;
appMap = pypkgs.buildPythonApplication rec {
inherit (prev.keyd) version src;
inherit patches;
2024-05-28 21:29:28 +03:00
2024-05-28 21:44:39 +03:00
pname = "keyd-application-mapper";
format = "other";
2024-05-28 21:29:28 +03:00
2024-05-28 21:44:39 +03:00
postPatch = ''
substituteInPlace scripts/${pname} \
--replace /bin/sh ${prev.runtimeShell}
'';
2024-05-28 21:29:28 +03:00
2024-05-28 21:44:39 +03:00
propagatedBuildInputs = with pypkgs; [ xlib ];
2024-05-28 21:29:28 +03:00
2024-05-28 21:44:39 +03:00
dontBuild = true;
2024-05-28 21:29:28 +03:00
2024-05-28 21:44:39 +03:00
installPhase = ''
install -Dm555 -t $out/bin scripts/${pname}
2024-05-28 21:29:28 +03:00
'';
2024-05-28 21:44:39 +03:00
meta.mainProgram = "keyd-application-mapper";
};
in ''
ln -sf ${lib.getExe appMap} $out/bin/${appMap.pname}
rm -rf $out/etc
'';
});
2024-05-28 14:18:25 +03:00
})];
}