blob: 7395c807389a1be1d3ca75039c93f1050e3355de (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
{ stdenv
, lib
, fetchFromGitHub
, systemd
, runtimeShell
, python3
, nixosTests
}:
let
version = "2.5.0";
src = fetchFromGitHub {
owner = "rvaiya";
repo = "keyd";
rev = "v" + version;
hash = "sha256-pylfQjTnXiSzKPRJh9Jli1hhin/MIGIkZxLKxqlReVo=";
};
pypkgs = python3.pkgs;
appMap = pypkgs.buildPythonApplication rec {
pname = "keyd-application-mapper";
inherit version src;
format = "other";
postPatch = ''
substituteInPlace scripts/${pname} \
--replace-fail /bin/sh ${runtimeShell}
'';
propagatedBuildInputs = with pypkgs; [ xlib ];
dontBuild = true;
installPhase = ''
install -Dm555 -t $out/bin scripts/${pname}
'';
meta.mainProgram = "keyd-application-mapper";
};
in
stdenv.mkDerivation {
pname = "keyd";
inherit version src;
postPatch = ''
substituteInPlace Makefile \
--replace-fail /usr/local ""
substituteInPlace keyd.service.in \
--replace-fail @PREFIX@ $out
'';
installFlags = [ "DESTDIR=${placeholder "out"}" ];
buildInputs = [ systemd ];
enableParallelBuilding = true;
# post-2.4.2 may need this to unbreak the test
# makeFlags = [ "SOCKET_PATH/run/keyd/keyd.socket" ];
postInstall = ''
ln -sf ${lib.getExe appMap} $out/bin/${appMap.pname}
rm -rf $out/etc
'';
passthru.tests.keyd = nixosTests.keyd;
meta = with lib; {
description = "Key remapping daemon for Linux";
license = licenses.mit;
maintainers = with maintainers; [ alfarel ];
platforms = platforms.linux;
};
}
|