summary refs log tree commit diff
path: root/pkgs/development/libraries/libguestfs/default.nix
blob: 313934c66574f735be4389d6355fe27653b25686 (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
{ stdenv, fetchurl, pkgconfig, autoconf, automake, libtool, makeWrapper
, ncurses, cpio, gperf, perl, cdrkit, flex, bison, qemu, pcre, augeas, libxml2
, acl, libcap, libcap_ng, libconfig, systemd, fuse, yajl, libvirt, hivex
, gmp, readline, file, libintlperl, GetoptLong, SysVirt }:

stdenv.mkDerivation rec {
  name = "libguestfs-${version}";
  version = "1.29.5";

  appliance = fetchurl {
    url = "http://libguestfs.org/download/binaries/appliance/appliance-1.26.0.tar.xz";
    sha256 = "1kzvgmy845kclvr93y6rdpss2q0p8yfqg14r0i1pi5r4zc68yvj4";
  };

  src = fetchurl {
    url = "http://libguestfs.org/download/1.29-development/libguestfs-${version}.tar.gz";
    sha256 = "1il0p3irwcyfdm83935hj4bvxsx0kdfn8dvqmg2lbzap17jvzj8h";
  };

  buildInputs = [
    makeWrapper pkgconfig autoconf automake libtool ncurses cpio gperf perl
    cdrkit flex bison qemu pcre augeas libxml2 acl libcap libcap_ng libconfig
    systemd fuse yajl libvirt gmp readline file hivex libintlperl GetoptLong
    SysVirt
  ];

  configureFlags = "--disable-appliance --disable-daemon";
  patches = [ ./libguestfs-syms.patch ];
  NIX_CFLAGS_COMPILE="-I${libxml2}/include/libxml2/";

  preConfigure = ''
    AUTOPOINT=true LIBTOOLIZE=true autoreconf --verbose --install
  '';

  postInstall = ''
    for bin in $out/bin/*; do
      wrapProgram "$bin" \
        --prefix "PATH" : "$out/bin:${hivex}/bin" \
        --prefix "PERL5LIB" : "$PERL5LIB:$out/lib/perl5/site_perl"
    done
  '';

  postFixup = ''
    mkdir -p "$out/lib/guestfs"
    tar -Jxvf "$appliance" --strip 1 -C "$out/lib/guestfs"
  '';

  meta = with stdenv.lib; {
    description = "Tools for accessing and modifying virtual machine disk images";
    license = licenses.gpl2;
    homepage = http://libguestfs.org/;
    maintainers = with maintainers; [offline];
    platforms = with platforms; linux;
    hydraPlatforms = [];
  };
}