Skip to content

Commit 4f1cade

Browse files
committed
chv: improve derivation build
We now have much more explicit control over the compilation options, independent of what Cloud Hypervisor's Cargo.toml defines in its Cargo.toml. Further, this does some cleanup to prepare the upgrade to v50, which requires a few minor changes in how Cloud Hypervisor is build. On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
1 parent d14a5fe commit 4f1cade

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

chv.nix

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

17-
commonArgs = {
18-
meta = cloud-hypervisor-meta;
17+
commonArgs = {
18+
src = craneLib'.cleanCargoSource cloud-hypervisor-src;
19+
meta = cloud-hypervisor-meta;
1920

20-
src = craneLib'.cleanCargoSource cloud-hypervisor-src;
21+
# Pragmatic release profile with debug-ability and faster
22+
# compilation times in mind.
23+
env = {
24+
CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS = "true";
25+
CARGO_PROFILE_RELEASE_OPT_LEVEL = 2;
26+
CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS = "true";
27+
CARGO_PROFILE_RELEASE_LTO = "no";
28+
};
2129

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";
30+
nativeBuildInputs = [
31+
pkg-config
32+
];
33+
buildInputs = [
34+
openssl
35+
];
36+
# Fix build. Reference:
37+
# - https://github.com/sfackler/rust-openssl/issues/1430
38+
# - https://docs.rs/openssl/latest/openssl/
39+
OPENSSL_NO_VENDOR = true;
2940
};
3041

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-
4342
# Downloaded and compiled dependencies.
4443
cargoArtifacts = craneLib'.buildDepsOnly (
4544
commonArgs
4645
// {
47-
# "suffix '-deps' will be appended
48-
pname = "cloud-hypervisor";
4946
doCheck = false;
5047
}
5148
);
@@ -54,8 +51,8 @@ let
5451
commonArgs
5552
// {
5653
inherit cargoArtifacts;
57-
pname = "cloud-hypervisor";
58-
# Don't execute tests here. We want this in a dedicated step.
54+
# Don't execute tests here. Too expensive for local development with
55+
# frequent rebuilds + little benefit.
5956
doCheck = false;
6057
cargoExtraArgs = "--features kvm";
6158
}

0 commit comments

Comments
 (0)