lol
1{
2 lib,
3 stdenv,
4 fetchurl,
5 bash-completion,
6 bison,
7 cdrkit,
8 cpio,
9 curl,
10 flex,
11 getopt,
12 glib,
13 gnupg,
14 hivex,
15 jansson,
16 libguestfs-with-appliance,
17 libosinfo,
18 libvirt,
19 libxml2,
20 makeWrapper,
21 ncurses,
22 ocamlPackages,
23 openssl,
24 pcre2,
25 perlPackages,
26 pkg-config,
27 qemu,
28 xz,
29 gitUpdater,
30}:
31
32stdenv.mkDerivation (finalAttrs: {
33 pname = "guestfs-tools";
34 version = "1.52.3";
35
36 src = fetchurl {
37 url = "https://download.libguestfs.org/guestfs-tools/${lib.versions.majorMinor finalAttrs.version}-stable/guestfs-tools-${finalAttrs.version}.tar.gz";
38 hash = "sha256-0xLCwj6TXU5b+tUewhKE9X0E+FN0MpX6+V+WHFxmiEc=";
39 };
40
41 nativeBuildInputs = [
42 bison
43 cdrkit
44 cpio
45 flex
46 getopt
47 makeWrapper
48 pkg-config
49 qemu
50 ]
51 ++ (with perlPackages; [
52 GetoptLong
53 libintl-perl
54 ModuleBuild
55 perl
56 Po4a
57 ])
58 ++ (with ocamlPackages; [
59 findlib
60 ocaml
61 ounit2
62 ]);
63
64 buildInputs = [
65 bash-completion
66 glib
67 hivex
68 jansson
69 libguestfs-with-appliance
70 libosinfo
71 libvirt
72 libxml2
73 ncurses
74 openssl
75 pcre2
76 xz
77 ];
78
79 postPatch = ''
80 # If it uses the executable name, then there's nothing we can do
81 # when wrapping to stop it looking in
82 # $out/etc/.virt-builder-wrapped, which won't exist.
83 substituteInPlace common/mlstdutils/std_utils.ml \
84 --replace Sys.executable_name '(Array.get Sys.argv 0)'
85 '';
86
87 preConfigure = ''
88 patchShebangs ocaml-dep.sh.in ocaml-link.sh.in run.in
89 '';
90
91 makeFlags = [
92 "LIBGUESTFS_PATH=${libguestfs-with-appliance}/lib/guestfs"
93 ];
94
95 installFlags = [
96 "BASH_COMPLETIONS_DIR=${placeholder "out"}/share/bash-completion/completions"
97 ];
98
99 enableParallelBuilding = true;
100
101 postInstall = ''
102 wrapProgram $out/bin/virt-builder \
103 --argv0 virt-builder \
104 --prefix PATH : ${
105 lib.makeBinPath [
106 curl
107 gnupg
108 ]
109 }:$out/bin \
110 --suffix VIRT_BUILDER_DIRS : /etc:$out/etc
111 wrapProgram $out/bin/virt-win-reg \
112 --prefix PERL5LIB : ${
113 with perlPackages;
114 makeFullPerlPath [
115 hivex
116 libintl-perl
117 libguestfs-with-appliance
118 ]
119 }
120 '';
121
122 passthru.updateScript = gitUpdater {
123 url = "https://github.com/libguestfs/guestfs-tools";
124 rev-prefix = "v";
125 odd-unstable = true;
126 };
127
128 meta = {
129 description = "Extra tools for accessing and modifying virtual machine disk images";
130 license = with lib.licenses; [
131 gpl2Plus
132 lgpl21Plus
133 ];
134 homepage = "https://libguestfs.org/";
135 changelog = "https://www.libguestfs.org/guestfs-tools-release-notes-${lib.versions.majorMinor finalAttrs.version}.1.html";
136 maintainers = [ ];
137 platforms = lib.platforms.linux;
138 hydraPlatforms = [ ];
139 };
140})