2022-11-21 17:40:18 +00:00
|
|
|
{ stdenv, lib, rust, rustPlatform, fetchgit, fetchpatch
|
|
|
|
, clang, pkg-config, protobuf, python3, wayland-scanner
|
2022-08-12 12:06:08 +00:00
|
|
|
, libcap, libdrm, libepoxy, minijail, virglrenderer, wayland, wayland-protocols
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "crosvm";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "107.1";
|
2022-09-09 14:08:57 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
src = fetchgit {
|
2022-11-21 17:40:18 +00:00
|
|
|
url = "https://chromium.googlesource.com/chromiumos/platform/crosvm";
|
|
|
|
rev = "5a49a836e63aa6e9ae38b80daa09a013a57bfb7f";
|
|
|
|
sha256 = "F+5i3R7Tbd9xF63Olnyavzg/hD+8HId1duWm8bvAmLA=";
|
2022-08-12 12:06:08 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
separateDebugInfo = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
patches = [
|
2022-11-21 17:40:18 +00:00
|
|
|
# Backport seccomp sandbox update for recent Glibc.
|
|
|
|
# fetchpatch is not currently gerrit/gitiles-compatible, so we
|
|
|
|
# have to use the mirror.
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/133604
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/google/crosvm/commit/aae01416807e7c15270b3d44162610bcd73952ff.patch";
|
|
|
|
sha256 = "nQuOMOwBu8QvfwDSuTz64SQhr2dF9qXt2NarbIU55tU=";
|
|
|
|
})
|
2022-08-12 12:06:08 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
cargoSha256 = "1jg9x5adz1lbqdwnzld4xg4igzmh90nd9xm287cgkvh5fbmsjfjv";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
nativeBuildInputs = [ clang pkg-config protobuf python3 wayland-scanner ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
buildInputs = [
|
2022-09-09 14:08:57 +00:00
|
|
|
libcap libdrm libepoxy minijail virglrenderer wayland wayland-protocols
|
2022-08-12 12:06:08 +00:00
|
|
|
];
|
2022-07-18 16:21:45 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
preConfigure = ''
|
|
|
|
patchShebangs third_party/minijail/tools/*.py
|
|
|
|
substituteInPlace build.rs --replace '"clang"' '"${stdenv.cc.targetPrefix}clang"'
|
2022-08-12 12:06:08 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
"CARGO_TARGET_${lib.toUpper (builtins.replaceStrings ["-"] ["_"] (rust.toRustTarget stdenv.hostPlatform))}_LINKER" =
|
|
|
|
"${stdenv.cc.targetPrefix}cc";
|
2022-08-21 13:32:41 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
# crosvm mistakenly expects the stable protocols to be in the root
|
|
|
|
# of the pkgdatadir path, rather than under the "stable"
|
|
|
|
# subdirectory.
|
|
|
|
PKG_CONFIG_WAYLAND_PROTOCOLS_PKGDATADIR =
|
|
|
|
"${wayland-protocols}/share/wayland-protocols/stable";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
buildFeatures = [ "default" "virgl_renderer" "virgl_renderer_next" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
passthru.updateScript = ./update.py;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A secure virtual machine monitor for KVM";
|
|
|
|
homepage = "https://chromium.googlesource.com/crosvm/crosvm/";
|
|
|
|
maintainers = with maintainers; [ qyliss ];
|
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = [ "aarch64-linux" "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|