2022-07-14 12:49:19 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, systemd
|
2022-09-09 14:08:57 +00:00
|
|
|
, runtimeShell
|
|
|
|
, python3
|
2023-03-24 00:07:29 +00:00
|
|
|
, nixosTests
|
2022-07-14 12:49:19 +00:00
|
|
|
}:
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
let
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "2.4.3";
|
2022-07-14 12:49:19 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rvaiya";
|
|
|
|
repo = "keyd";
|
|
|
|
rev = "v" + version;
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-NhZnFIdK0yHgFR+rJm4cW+uEhuQkOpCSLwlXNQy6jas=";
|
2022-07-14 12:49:19 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
pypkgs = python3.pkgs;
|
|
|
|
|
|
|
|
appMap = pypkgs.buildPythonApplication rec {
|
|
|
|
pname = "keyd-application-mapper";
|
|
|
|
inherit version src;
|
|
|
|
format = "other";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace scripts/${pname} \
|
|
|
|
--replace /bin/sh ${runtimeShell}
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = with pypkgs; [ xlib ];
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -Dm555 -t $out/bin scripts/${pname}
|
|
|
|
'';
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
meta.mainProgram = "keyd-application-mapper";
|
2022-09-09 14:08:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
2023-08-04 22:07:22 +00:00
|
|
|
stdenv.mkDerivation {
|
2022-09-09 14:08:57 +00:00
|
|
|
pname = "keyd";
|
|
|
|
inherit version src;
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile \
|
2022-09-09 14:08:57 +00:00
|
|
|
--replace /usr ""
|
2022-07-14 12:49:19 +00:00
|
|
|
|
|
|
|
substituteInPlace keyd.service \
|
|
|
|
--replace /usr/bin $out/bin
|
|
|
|
'';
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
installFlags = [ "DESTDIR=${placeholder "out"}" ];
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
buildInputs = [ systemd ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
# post-2.4.2 may need this to unbreak the test
|
|
|
|
# makeFlags = [ "SOCKET_PATH/run/keyd/keyd.socket" ];
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
postInstall = ''
|
2022-09-09 14:08:57 +00:00
|
|
|
ln -sf ${lib.getExe appMap} $out/bin/${appMap.pname}
|
2022-07-14 12:49:19 +00:00
|
|
|
rm -rf $out/etc
|
|
|
|
'';
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
passthru.tests.keyd = nixosTests.keyd;
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
meta = with lib; {
|
2024-01-13 08:15:51 +00:00
|
|
|
description = "A key remapping daemon for Linux";
|
2022-07-14 12:49:19 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ peterhoeg ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|