{ 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" ]; }; }); } ); devShells = forAllSystems ( system: let pkgs = nixpkgs.legacyPackages.${system}; inherit (pkgs) lib; in { default = pkgs.mkShell { inputsFrom = [ self.packages.${system}.cloud-hypervisor ]; nativeBuildInputs = with pkgs; [ clippy rustfmt ]; }; } ); }; }