forked from mirrors/nixpkgs
c01c68bf1c
manifest-versions never seems to contain the release build any more, so we can't use it to find the version of crosvm being served to CrOS devices. Instead, I've changed the update script to take the latest version of the appropriate crosvm Chrome OS release branch. This is the branch that gets served. Every release, it is branched off from the "chromeos" branch (which is the one that passes Chrome OS QA), and then collects any critical fixes over the lifetime of the release. With this change, I've introduced a new, simplified versioning scheme, e.g. 100.0. The tip build is always 1:1 with the Chrome version, so having both of those is redundant. The other number is the number of commits that have been added to the release branch after branching from the chromeos branch, so that the number will go up if we update to include a new commit from the same release.
64 lines
1.7 KiB
Nix
64 lines
1.7 KiB
Nix
{ stdenv, lib, rustPlatform, fetchgit
|
|
, pkg-config, wayland-scanner, libcap, minijail, wayland, wayland-protocols
|
|
, linux
|
|
}:
|
|
|
|
let
|
|
|
|
upstreamInfo = with builtins; fromJSON (readFile ./upstream-info.json);
|
|
|
|
arch = with stdenv.hostPlatform;
|
|
if isAarch64 then "aarch64"
|
|
else if isx86_64 then "x86_64"
|
|
else throw "no seccomp policy files available for host platform";
|
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "crosvm";
|
|
inherit (upstreamInfo) version;
|
|
|
|
src = fetchgit (builtins.removeAttrs upstreamInfo.src [ "date" "path" ]);
|
|
|
|
separateDebugInfo = true;
|
|
|
|
patches = [
|
|
./default-seccomp-policy-dir.diff
|
|
];
|
|
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
|
|
nativeBuildInputs = [ pkg-config wayland-scanner ];
|
|
|
|
buildInputs = [ libcap minijail wayland wayland-protocols ];
|
|
|
|
postPatch = ''
|
|
cp ${./Cargo.lock} Cargo.lock
|
|
sed -i "s|/usr/share/policy/crosvm/|$out/share/policy/|g" \
|
|
seccomp/*/*.policy
|
|
'';
|
|
|
|
preBuild = ''
|
|
export DEFAULT_SECCOMP_POLICY_DIR=$out/share/policy
|
|
'';
|
|
|
|
postInstall = ''
|
|
mkdir -p $out/share/policy/
|
|
cp seccomp/${arch}/* $out/share/policy/
|
|
'';
|
|
|
|
CROSVM_CARGO_TEST_KERNEL_BINARY =
|
|
lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform)
|
|
"${linux}/${stdenv.hostPlatform.linux-kernel.target}";
|
|
|
|
passthru.updateScript = ./update.py;
|
|
|
|
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" ];
|
|
};
|
|
}
|