evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / vi / virt-v2v / package.nix
blob4d6ce4e63f54e03c19cecfa4c883c595c1cae4b5
2   stdenv,
3   lib,
4   testers,
5   fetchurl,
6   pkg-config,
7   makeWrapper,
8   autoreconfHook,
9   bash-completion,
10   OVMF,
11   qemu,
12   ocamlPackages,
13   perl,
14   cpio,
15   getopt,
16   libosinfo,
17   pcre2,
18   libxml2,
19   jansson,
20   glib,
21   libguestfs-with-appliance,
22   cdrkit,
23   nbdkit,
24   withWindowsGuestSupport ? true,
25   pkgsCross, # for rsrvany
26   virtio-win,
29 stdenv.mkDerivation (finalAttrs: {
30   pname = "virt-v2v";
31   version = "2.6.0";
33   src = fetchurl {
34     url = "https://download.libguestfs.org/virt-v2v/${lib.versions.majorMinor finalAttrs.version}-stable/virt-v2v-${finalAttrs.version}.tar.gz";
35     sha256 = "sha256-W7t/n1QO9UebyH85abtnSY5i7kH/6h8JIAlFQoD1vkU=";
36   };
38   postPatch = ''
39     substituteInPlace common/mlv2v/uefi.ml \
40         --replace-fail '/usr/share/OVMF/OVMF_CODE.fd' "${OVMF.firmware}" \
41         --replace-fail '/usr/share/OVMF/OVMF_VARS.fd' "${OVMF.variables}"
43     patchShebangs .
44   '';
46   nativeBuildInputs =
47     [
48       pkg-config
49       autoreconfHook
50       makeWrapper
51       bash-completion
52       perl
53       libguestfs-with-appliance
54       qemu
55       cpio
56       cdrkit
57       getopt
58     ]
59     ++ (with ocamlPackages; [
60       ocaml
61       findlib
62     ]);
64   buildInputs =
65     [
66       libosinfo
67       pcre2
68       libxml2
69       jansson
70       glib
71     ]
72     ++ (with ocamlPackages; [
73       ocaml_libvirt
74       nbd
75     ]);
77   postInstall =
78     ''
79       for bin in $out/bin/*; do
80       wrapProgram "$bin" \
81         --prefix PATH : "$out/bin:${
82           lib.makeBinPath [
83             nbdkit
84             qemu
85           ]
86         }"
87       done
88     ''
89     + lib.optionalString withWindowsGuestSupport ''
90       ln -s "${virtio-win}" $out/share/virtio-win
91       ln -s "${pkgsCross.mingwW64.rhsrvany}/bin/" $out/share/virt-tools
92     '';
94   PKG_CONFIG_BASH_COMPLETION_COMPLETIONSDIR = "${placeholder "out"}/share/bash-completion/completions";
96   passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
98   meta = {
99     homepage = "https://github.com/libguestfs/virt-v2v";
100     description = "Convert guests from foreign hypervisors to run on KVM";
101     license = lib.licenses.gpl2Only;
102     maintainers = with lib.maintainers; [ lukts30 ];
103     platforms = lib.platforms.linux;
104     mainProgram = "virt-v2v";
105   };