forked from cloud-hypervisor/cloud-hypervisor
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathchv.nix
More file actions
69 lines (62 loc) · 1.76 KB
/
Copy pathchv.nix
File metadata and controls
69 lines (62 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Builds Cloud Hypervisor with using crane.
#
# Uses a pragmatic release profile with debug-ability and faster
# compilation times in mind without sacrificing too much performance.
{
# helper from nixpkgs
lib,
openssl,
pkg-config,
# other helper
craneLib,
# other
meta, # meta of pkgs.cloud-hypervisor
src, # clean source
chExtraVersion, # Additional information to be appended to the version string.
}:
let
commonArgs = {
inherit meta 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";
# 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 = "thin";
# Fix build. Reference:
# - https://github.com/sfackler/rust-openssl/issues/1430
# - https://docs.rs/openssl/latest/openssl/
OPENSSL_NO_VENDOR = true;
# Sets additional information to be appended to the version string.
CH_EXTRA_VERSION = chExtraVersion;
};
nativeBuildInputs = [
pkg-config
];
buildInputs = [
openssl
];
};
# Downloaded and compiled dependencies.
cargoArtifacts = craneLib.buildDepsOnly (
commonArgs
// {
doCheck = false;
}
);
cargoPackageKvm = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
# Don't execute tests here. Too expensive for local development with
# frequent rebuilds + little benefit.
doCheck = false;
cargoExtraArgs = "--features kvm";
}
);
in
cargoPackageKvm