1{ lib, stdenv, fetchFromGitHub, fetchpatch
2, meson, ninja, pkg-config, unixtools
3, dbus, libcap, polkit, systemd
4}:
5
6stdenv.mkDerivation rec {
7 pname = "rtkit";
8 version = "0.13";
9
10 src = fetchFromGitHub {
11 owner = "heftig";
12 repo = "rtkit";
13 rev = "c295fa849f52b487be6433e69e08b46251950399";
14 sha256 = "0yfsgi3pvg6dkizrww1jxpkvcbhzyw9110n1dypmzq0c5hlzjxcd";
15 };
16
17 patches = [
18 (fetchpatch {
19 name = "meson-actual-use-systemd_systemunitdir.patch";
20 url = "https://github.com/heftig/rtkit/pull/19/commits/7d62095b94f8df3891c984a1535026d2658bb177.patch";
21 sha256 = "17acv549zqcgh7sgprfagbf6drqsr0zdwvf1dsqda7wlqc2h9zn7";
22 })
23
24 (fetchpatch {
25 name = "meson-fix-librt-find_library-check.patch";
26 url = "https://github.com/heftig/rtkit/pull/18/commits/98f70edd8f534c371cb4308b9720739c5178918d.patch";
27 sha256 = "18mnjjsdjfr184nkzi01xyphpdngi31ry4bmkv9ysjxf9wilv4nl";
28 })
29
30 (fetchpatch {
31 name = "rtkit-daemon-dont-log-debug-messages-by-default.patch";
32 url = "https://github.com/heftig/rtkit/pull/33/commits/ad649ee491ed1a41537774ad11564a208e598a09.patch";
33 sha256 = "sha256-p+MdJVMv58rFd1uc1UFKtq83RquDSFZ3M6YfaBU12UU=";
34 })
35 ];
36
37 nativeBuildInputs = [ meson ninja pkg-config unixtools.xxd ];
38 buildInputs = [ dbus libcap polkit systemd ];
39
40 mesonFlags = [
41 "-Dinstalled_tests=false"
42
43 "-Ddbus_systemservicedir=${placeholder "out"}/share/dbus-1/system-services"
44 "-Ddbus_interfacedir=${placeholder "out"}/share/dbus-1/interfaces"
45 "-Ddbus_rulesdir=${placeholder "out"}/etc/dbus-1/system.d"
46 "-Dpolkit_actiondir=${placeholder "out"}/share/polkit-1/actions"
47 "-Dsystemd_systemunitdir=${placeholder "out"}/etc/systemd/system"
48 ];
49
50 meta = with lib; {
51 homepage = "https://github.com/heftig/rtkit";
52 description = "A daemon that hands out real-time priority to processes";
53 mainProgram = "rtkitctl";
54 license = with licenses; [ gpl3 bsd0 ]; # lib is bsd license
55 platforms = platforms.linux;
56 };
57}