1{ lib, stdenv,
2 fetchFromGitHub,
3 autoreconfHook,
4 bison,
5 flex,
6 glib,
7 pkg-config,
8 json_c,
9 xen,
10 libvirt,
11 xenSupport ? true }:
12
13stdenv.mkDerivation rec {
14 pname = "libvmi";
15 version = "0.12.0";
16 libVersion = "0.0.12";
17
18 src = fetchFromGitHub {
19 owner = "libvmi";
20 repo = "libvmi";
21 rev = "v${version}";
22 sha256 = "0wbi2nasb1gbci6cq23g6kq7i10rwi1y7r44rl03icr5prqjpdyv";
23 };
24
25 buildInputs = [ glib libvirt json_c ] ++ (lib.optional xenSupport xen);
26 nativeBuildInputs = [ autoreconfHook bison flex pkg-config ];
27
28 configureFlags = lib.optional (!xenSupport) "--disable-xen";
29
30 # libvmi uses dlopen() for the xen libraries, however autoPatchelfHook doesn't work here
31 postFixup = lib.optionalString xenSupport ''
32 libvmi="$out/lib/libvmi.so.${libVersion}"
33 oldrpath=$(patchelf --print-rpath "$libvmi")
34 patchelf --set-rpath "$oldrpath:${lib.makeLibraryPath [ xen ]}" "$libvmi"
35 '';
36
37 meta = with lib; {
38 homepage = "https://libvmi.com/";
39 description = "C library for virtual machine introspection";
40 longDescription = ''
41 LibVMI is a C library with Python bindings that makes it easy to monitor the low-level
42 details of a running virtual machine by viewing its memory, trapping on hardware events,
43 and accessing the vCPU registers.
44 '';
45 license = with licenses; [ gpl3 lgpl3 ];
46 platforms = platforms.linux;
47 maintainers = [ ];
48 };
49}