Skip to content

Commit bef0ed2

Browse files
committed
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] cloud-hypervisor/cloud-hypervisor#7525
1 parent e448e6b commit bef0ed2

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

chv.nix

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,43 @@ let
1414
# Crane lib with proper Rust toolchain
1515
craneLib' = craneLib.overrideToolchain rustToolchain;
1616

17-
commonArgs = {
18-
meta = cloud-hypervisor-meta;
17+
commonArgs =
18+
let
19+
src = craneLib'.cleanCargoSource cloud-hypervisor-src;
20+
in
21+
{
22+
inherit src;
23+
# Since Nov 2025 (v50), Cloud Hypervisor has a virtual manifest and the
24+
# main package was moved into a sub directory.
25+
cargoToml = "${src}/cloud-hypervisor/Cargo.toml";
26+
meta = cloud-hypervisor-meta;
1927

20-
src = craneLib'.cleanCargoSource cloud-hypervisor-src;
28+
# Pragmatic release profile with debug-ability and faster
29+
# compilation times in mind.
30+
env = {
31+
CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS = "true";
32+
CARGO_PROFILE_RELEASE_OPT_LEVEL = 2;
33+
CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS = "true";
34+
CARGO_PROFILE_RELEASE_LTO = "no";
35+
};
2136

22-
# Pragmatic release profile with debug-ability and faster
23-
# compilation times in mind.
24-
env = {
25-
CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS = "true";
26-
CARGO_PROFILE_RELEASE_OPT_LEVEL = 2;
27-
CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS = "true";
28-
CARGO_PROFILE_RELEASE_LTO = "no";
37+
nativeBuildInputs = [
38+
pkg-config
39+
];
40+
buildInputs = [
41+
openssl
42+
];
43+
# Fix build. Reference:
44+
# - https://github.com/sfackler/rust-openssl/issues/1430
45+
# - https://docs.rs/openssl/latest/openssl/
46+
OPENSSL_NO_VENDOR = true;
2947
};
3048

31-
nativeBuildInputs = [
32-
pkg-config
33-
];
34-
buildInputs = [
35-
openssl
36-
];
37-
# Fix build. Reference:
38-
# - https://github.com/sfackler/rust-openssl/issues/1430
39-
# - https://docs.rs/openssl/latest/openssl/
40-
OPENSSL_NO_VENDOR = true;
41-
};
42-
4349
# Downloaded and compiled dependencies.
4450
cargoArtifacts = craneLib'.buildDepsOnly (
4551
commonArgs
4652
// {
4753
# "suffix '-deps' will be appended
48-
pname = "cloud-hypervisor";
4954
doCheck = false;
5055
}
5156
);
@@ -54,7 +59,6 @@ let
5459
commonArgs
5560
// {
5661
inherit cargoArtifacts;
57-
pname = "cloud-hypervisor";
5862
# Don't execute tests here. We want this in a dedicated step.
5963
doCheck = false;
6064
cargoExtraArgs = "--features kvm";

0 commit comments

Comments
 (0)