From 20201cc92bfe90fe310e8def0708dcdc3dc9c8e9 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Wed, 17 Dec 2025 11:42:49 +0100 Subject: [PATCH] nix/chv: adapt to new crate structure Since PR #7525 (Dec 2025)[0], Cloud Hypervisor uses a virtual Cargo manifest and the main package was moved to the `./cloud-hypervisor` subdirectory. This change is effective since v50. As our v49-based CHV version backported these changes already, we need to adapt the Nix build of CHV. [0] https://github.com/cloud-hypervisor/cloud-hypervisor/pull/7525 Signed-off-by: Philipp Schuster On-behalf-of: SAP philipp.schuster@sap.com --- chv.nix | 53 ++++++++++++++++++++++++++++------------------------- flake.lock | 27 +++++++++++++-------------- flake.nix | 6 +++--- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/chv.nix b/chv.nix index 1656922..f636654 100644 --- a/chv.nix +++ b/chv.nix @@ -14,38 +14,42 @@ let # Crane lib with proper Rust toolchain craneLib' = craneLib.overrideToolchain rustToolchain; - commonArgs = { - meta = cloud-hypervisor-meta; + commonArgs = + let + src = craneLib'.cleanCargoSource cloud-hypervisor-src; + in + { + inherit src; + # Since Nov 2025 (v50), Cloud Hypervisor has a virtual manifest and the + # main package was moved into a sub directory. + cargoToml = "${src}/cloud-hypervisor/Cargo.toml"; + meta = cloud-hypervisor-meta; - src = craneLib'.cleanCargoSource cloud-hypervisor-src; + # Pragmatic release profile with debug-ability and faster + # compilation times in mind. + env = { + CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS = "true"; + CARGO_PROFILE_RELEASE_OPT_LEVEL = 2; + CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS = "true"; + CARGO_PROFILE_RELEASE_LTO = "no"; + }; - # Pragmatic release profile with debug-ability and faster - # compilation times in mind. - env = { - CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS = "true"; - CARGO_PROFILE_RELEASE_OPT_LEVEL = 2; - CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS = "true"; - CARGO_PROFILE_RELEASE_LTO = "no"; + nativeBuildInputs = [ + pkg-config + ]; + buildInputs = [ + openssl + ]; + # Fix build. Reference: + # - https://github.com/sfackler/rust-openssl/issues/1430 + # - https://docs.rs/openssl/latest/openssl/ + OPENSSL_NO_VENDOR = true; }; - nativeBuildInputs = [ - pkg-config - ]; - buildInputs = [ - openssl - ]; - # Fix build. Reference: - # - https://github.com/sfackler/rust-openssl/issues/1430 - # - https://docs.rs/openssl/latest/openssl/ - OPENSSL_NO_VENDOR = true; - }; - # Downloaded and compiled dependencies. cargoArtifacts = craneLib'.buildDepsOnly ( commonArgs // { - # "suffix '-deps' will be appended - pname = "cloud-hypervisor"; doCheck = false; } ); @@ -54,7 +58,6 @@ let commonArgs // { inherit cargoArtifacts; - pname = "cloud-hypervisor"; # Don't execute tests here. We want this in a dedicated step. doCheck = false; cargoExtraArgs = "--features kvm"; diff --git a/flake.lock b/flake.lock index eaab4c8..3d3ad01 100644 --- a/flake.lock +++ b/flake.lock @@ -3,18 +3,17 @@ "cloud-hypervisor-src": { "flake": false, "locked": { - "lastModified": 1764947614, - "narHash": "sha256-ptMDewPVs13ZOFdJLAJhLXvfa8A3PihAzjiSPbLxZ7M=", - "owner": "cyberus-technology", - "repo": "cloud-hypervisor", - "rev": "d4cb05de4d7fe1b4300ce4d6bed56ae7fc04e19b", - "type": "github" + "lastModified": 1765965589, + "narHash": "sha256-A4q/mZbe2cZD5L6w8nL3EwsKNlM9onfESIlQQze/iXE=", + "ref": "refs/heads/next-gardenlinux-v49", + "rev": "89ab61df57d7c57363f4618ca667a788479a34c2", + "revCount": 9120, + "type": "git", + "url": "file:/home/pschuster/dev/cloud-hypervisor" }, "original": { - "owner": "cyberus-technology", - "ref": "gardenlinux", - "repo": "cloud-hypervisor", - "type": "github" + "type": "git", + "url": "file:/home/pschuster/dev/cloud-hypervisor" } }, "crane": { @@ -90,11 +89,11 @@ "libvirt-src": { "flake": false, "locked": { - "lastModified": 1764948266, - "narHash": "sha256-fhqa7QzUv+sn7OAI+xdT1wPTGl02RnxtSHquQkRqCg0=", + "lastModified": 1765369052, + "narHash": "sha256-PolVaV1Mz9MLUO4bV3lrsXGJGTmHvhwit1Jgar1WaW8=", "ref": "gardenlinux", - "rev": "b0b849c70fa7eaba4409373531f031be8add5a3d", - "revCount": 52405, + "rev": "98ba7e312ed17cc9029d25ae5b187779d5a7d580", + "revCount": 52413, "submodules": true, "type": "git", "url": "https://github.com/cyberus-technology/libvirt" diff --git a/flake.nix b/flake.nix index c33847d..d3acd4e 100644 --- a/flake.nix +++ b/flake.nix @@ -8,14 +8,14 @@ # A local path can be used for developing or testing local changes. Make # sure the submodules in a local libvirt checkout are populated. libvirt-src = { - # url = "git+file:?submodules=1"; + # url = "git+file:/home/pschuster/dev/libvirt?submodules=1"; url = "git+https://github.com/cyberus-technology/libvirt?ref=gardenlinux&submodules=1"; # url = "git+ssh://git@gitlab.cyberus-technology.de/cyberus/cloud/libvirt?ref=managedsave-fix&submodules=1"; flake = false; }; cloud-hypervisor-src = { - # url = "git+file:"; - url = "github:cyberus-technology/cloud-hypervisor?ref=gardenlinux"; + url = "git+file:/home/pschuster/dev/cloud-hypervisor"; + # url = "github:cyberus-technology/cloud-hypervisor?ref=gardenlinux"; flake = false; }; edk2-src = {