cloud-hypervisor/flake.nix
Davíð Steinn Geirsson e3372a22f6
Some checks are pending
Cloud Hypervisor Tests (Metrics) / Tests (Metrics) (push) Waiting to run
REUSE Compliance Check / REUSE Compliance Check (push) Waiting to run
Shell scripts check / Check shell scripts (push) Waiting to run
build: Switch vhost/vhost-user-backend to dsg fork
Use vhost 0.15.0 and vhost-user-backend 0.21.0 from
https://git.dsg.is/dsg/vhost.git instead of crates.io.

This required bumping several rust-vmm dependencies to maintain
compatibility with the newer vm-memory 0.17.x and vmm-sys-util 0.15.x
APIs used by the fork:

- kvm-bindings: 0.12.1 → 0.14.0
- kvm-ioctls: 0.22.1 → 0.24.0 (nested_state renamed)
- linux-loader: 0.13.1 → 0.13.2
- vfio-bindings: 0.6.0 → 0.6.1
- vfio-ioctls: 0.5.1 → 0.5.2 (VfioDevice::new takes Arc<dyn VfioOps>)
- vfio_user: 0.1.1 → 0.1.2
- virtio-queue: 0.16.0 → 0.17.0
- vm-memory: 0.16.1 → 0.17.1 (Error split, Bytes trait, VolatileSlice)
- vmm-sys-util: 0.14.0 → 0.15.0 (EventConsumer/EventNotifier API)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 17:15:59 +00:00

83 lines
2.5 KiB
Nix

{
description = "Cloud Hypervisor DSG fork";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
{ self, nixpkgs }:
let
supportedSystems = [
"aarch64-linux"
"riscv64-linux"
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
in
{
default = self.packages.${system}.cloud-hypervisor;
cloud-hypervisor = pkgs.rustPlatform.buildRustPackage (finalAttrs: {
pname = "cloud-hypervisor";
version = "50.0.0";
src = self;
# After updating Cargo.lock with `cargo update`, fill in the hashes
# for the git-sourced vhost packages by running `nix build` and
# replacing lib.fakeHash with the hash reported in the error message.
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"micro_http-0.1.0" = "sha256-XemdzwS25yKWEXJcRX2l6QzD7lrtroMeJNOUEWGR7WQ=";
"vhost-0.15.0" = "sha256-iH5Zr9lSlkWhhdOQTSiPQ/mHBaKJ/oamTJZgY68tnGg=";
"vhost-user-backend-0.21.0" = "sha256-iH5Zr9lSlkWhhdOQTSiPQ/mHBaKJ/oamTJZgY68tnGg=";
};
};
separateDebugInfo = true;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs =
[ pkgs.openssl ]
++ lib.optional pkgs.stdenv.hostPlatform.isAarch64 pkgs.dtc;
env.OPENSSL_NO_VENDOR = true;
cargoTestFlags = [
"--workspace"
"--exclude"
"hypervisor" # /dev/kvm
"--exclude"
"net_util" # /dev/net/tun
"--exclude"
"virtio-devices" # seccomp
"--exclude"
"vmm" # /dev/kvm
];
meta = {
homepage = "https://git.dsg.is/dsg/cloud-hypervisor";
description = "Open source Virtual Machine Monitor (VMM) that runs on top of KVM";
license = with lib.licenses; [
asl20
bsd3
];
mainProgram = "cloud-hypervisor";
platforms = [
"aarch64-linux"
"riscv64-linux"
"x86_64-linux"
];
};
});
}
);
};
}