1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rustPlatform,
6 pkg-config,
7 dtc,
8 openssl,
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "cloud-hypervisor";
13 version = "47.0";
14
15 src = fetchFromGitHub {
16 owner = "cloud-hypervisor";
17 repo = "cloud-hypervisor";
18 rev = "v${version}";
19 hash = "sha256-NzvK6gKu7pWwTqLaeDKyYedIjzRa85k9PGUGfeA2Y4c=";
20 };
21
22 cargoHash = "sha256-s3lBlYbE9xoLov8JWeX89A7J00tCISoCDHHBoEcILus=";
23
24 separateDebugInfo = true;
25
26 nativeBuildInputs = [ pkg-config ];
27 buildInputs = lib.optional stdenv.hostPlatform.isAarch64 dtc;
28 checkInputs = [ openssl ];
29
30 OPENSSL_NO_VENDOR = true;
31
32 cargoTestFlags = [
33 "--workspace"
34 "--bins"
35 "--lib" # Integration tests require root.
36 "--exclude"
37 "hypervisor" # /dev/kvm
38 "--exclude"
39 "net_util" # /dev/net/tun
40 "--exclude"
41 "vmm" # /dev/kvm
42 ];
43
44 meta = {
45 homepage = "https://github.com/cloud-hypervisor/cloud-hypervisor";
46 description = "Open source Virtual Machine Monitor (VMM) that runs on top of KVM";
47 changelog = "https://github.com/cloud-hypervisor/cloud-hypervisor/releases/tag/v${version}";
48 license = with lib.licenses; [
49 asl20
50 bsd3
51 ];
52 mainProgram = "cloud-hypervisor";
53 maintainers = with lib.maintainers; [
54 offline
55 qyliss
56 ];
57 platforms = [
58 "aarch64-linux"
59 "riscv64-linux"
60 "x86_64-linux"
61 ];
62 };
63}