Unverified Commit 6c437afe authored by Fernando Rodrigues's avatar Fernando Rodrigues
Browse files

libvmi: 0.12.0 -> 0.14.0-unstable-2024-08-06



Also splits the package output and adds more configuration options.

Signed-off-by: default avatarFernando Rodrigues <alpha@sigmasquadron.net>
parent 0fae3ce9
Loading
Loading
Loading
Loading
+54 −22
Original line number Diff line number Diff line
@@ -2,64 +2,96 @@
  lib,
  stdenv,
  fetchFromGitHub,
  unstableGitUpdater,
  autoreconfHook,
  autoconf-archive,
  bison,
  flex,
  glib,
  pkg-config,
  json_c,
  xen,
  libvirt,

  withVMIFS ? true,
  fuse,

  legacyKVM ? false,
  libkvmi,

  xenSupport ? true,
  xen-slim,
}:

stdenv.mkDerivation rec {
let
  pname = "libvmi";
  version = "0.12.0";
  libVersion = "0.0.12";
  version = "0.14.0-unstable-2024-08-06";
  libVersion = "0.0.15";

  src = fetchFromGitHub {
    owner = "libvmi";
    repo = "libvmi";
    rev = "v${version}";
    sha256 = "0wbi2nasb1gbci6cq23g6kq7i10rwi1y7r44rl03icr5prqjpdyv";
    rev = "bdb9ffb8f1f70b425454bc41da2be353cc6cbf5c";
    hash = "sha256-5K+9Qq5vGeYYy8kqWIeO25iNJoD/HvtyircH6odr/qA=";
  };
in

stdenv.mkDerivation {
  inherit pname version src;

  outputs = [
    "out"
    "lib"
    "dev"
  ];

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

  configureFlags = lib.optional (!xenSupport) "--disable-xen";
  buildInputs =
    [
      glib
      json_c
      libvirt
    ]
    ++ lib.optionals xenSupport [ xen-slim ]
    ++ lib.optionals (!legacyKVM) [ libkvmi ]
    ++ lib.optionals withVMIFS [ fuse ];

  configureFlags =
    lib.optionals (!xenSupport) [ "--disable-xen" ]
    ++ lib.optionals legacyKVM [ "--enable-kvm-legacy" ]
    ++ lib.optionals withVMIFS [ "--enable-vmifs" ];

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

  meta = with lib; {
    homepage = "https://libvmi.com/";
  passthru = {
    updateScript = unstableGitUpdater { tagPrefix = "v"; };
    inherit libVersion;
  };

  meta = {
    description = "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
    homepage = "https://libvmi.com/";
    license = with lib.licenses; [
      gpl3Only
      lgpl3Only
    ];
    platforms = platforms.linux;
    maintainers = [ ];
    broken = true;
    platforms = [ "x86_64-linux" ];
    maintainers = with lib.maintainers; [ sigmasquadron ];
  };
}