summary refs log tree commit diff
path: root/pkgs/development/libraries/libvmi/default.nix
blob: 9d9e47407b6296bb3992261b3714359455c814a1 (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
{ lib, stdenv,
  fetchFromGitHub,
  autoreconfHook,
  bison,
  flex,
  glib,
  pkg-config,
  json_c,
  xen,
  libvirt,
  xenSupport ? true }:

with lib;

stdenv.mkDerivation rec {
  pname = "libvmi";
  version = "0.12.0";
  libVersion = "0.0.12";

  src = fetchFromGitHub {
    owner = "libvmi";
    repo = "libvmi";
    rev = "v${version}";
    sha256 = "0wbi2nasb1gbci6cq23g6kq7i10rwi1y7r44rl03icr5prqjpdyv";
  };

  buildInputs = [ glib libvirt json_c ] ++ (optional xenSupport xen);
  nativeBuildInputs = [ autoreconfHook bison flex pkg-config ];

  configureFlags = optional (!xenSupport) "--disable-xen";

  # libvmi uses dlopen() for the xen libraries, however autoPatchelfHook doesn't work here
  postFixup = optionalString xenSupport ''
    libvmi="$out/lib/libvmi.so.${libVersion}"
    oldrpath=$(patchelf --print-rpath "$libvmi")
    patchelf --set-rpath "$oldrpath:${makeLibraryPath [ xen ]}" "$libvmi"
  '';

  meta = with lib; {
    homepage = "http://libvmi.com/";
    description = "A C library for virtual machine introspection";
    longDescription = ''
      LibVMI is a C library with Python bindings that makes it easy to monitor the low-level
      details of a running virtual machine by viewing its memory, trapping on hardware events,
      and accessing the vCPU registers.
    '';
    license = with licenses; [ gpl3 lgpl3 ];
    platforms = platforms.linux;
    maintainers = with maintainers; [ matthiasbeyer ];
  };
}