1{ lib, stdenv, fetchFromGitHub, rustPlatform, pkg-config, dtc, openssl }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "cloud-hypervisor";
5 version = "39.0";
6
7 src = fetchFromGitHub {
8 owner = "cloud-hypervisor";
9 repo = pname;
10 rev = "v${version}";
11 hash = "sha256-sMnfeICo/PhpljstTIj4CiE4QBuyVKYD9oWvWf0Ouew=";
12 };
13
14 cargoLock = {
15 lockFile = ./Cargo.lock;
16 outputHashes = {
17 "acpi_tables-0.1.0" = "sha256-a6ojB2XVeH+YzzXRle0agg+ljn0Jsgyaf6TJZAGt8sQ=";
18 "igvm-0.1.9" = "sha256-OztgRiv+//27MS9SqSBJPbrVlXihK2m9UkG4REZ9Vn0=";
19 "micro_http-0.1.0" = "sha256-yIgcoEfc7eeS1+bijzkifaBxVNHa71Y+Vn79owMaKvM=";
20 "mshv-bindings-0.1.1" = "sha256-US/AzS7iRUQijkGs1EG04Hk4Q7dPz65BeTMsI8rtMqw=";
21 "vfio-bindings-0.4.0" = "sha256-k8Hf5y8MiTnd3k2iEgnnX/o8VdVS7prKlnssyEerVRM=";
22 "vfio_user-0.1.0" = "sha256-LJ84k9pMkSAaWkuaUd+2LnPXnNgrP5LdbPOc1Yjz5xA=";
23 "vm-fdt-0.3.0" = "sha256-9PywgSnSL+8gT6lcl9t6w7X4fEINa+db+H1vWS+gDOI=";
24 };
25 };
26
27 separateDebugInfo = true;
28
29 nativeBuildInputs = [ pkg-config ];
30 buildInputs = [ openssl ] ++ lib.optional stdenv.isAarch64 dtc;
31
32 OPENSSL_NO_VENDOR = true;
33
34 cargoTestFlags = [
35 "--workspace"
36 "--bins" "--lib" # Integration tests require root.
37 "--exclude" "net_util" # /dev/net/tun
38 "--exclude" "vmm" # /dev/kvm
39 ];
40
41 meta = with lib; {
42 homepage = "https://github.com/cloud-hypervisor/cloud-hypervisor";
43 description = "Open source Virtual Machine Monitor (VMM) that runs on top of KVM";
44 changelog = "https://github.com/cloud-hypervisor/cloud-hypervisor/releases/tag/v${version}";
45 license = with licenses; [ asl20 bsd3 ];
46 mainProgram = "cloud-hypervisor";
47 maintainers = with maintainers; [ offline qyliss ];
48 platforms = [ "aarch64-linux" "x86_64-linux" ];
49 };
50}