2024-01-25 14:12:00 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchgit
|
|
|
|
, fetchpatch
|
|
|
|
, cargo
|
|
|
|
, pkg-config
|
|
|
|
, rustPlatform
|
|
|
|
, aemu
|
|
|
|
, gfxstream
|
|
|
|
, libdrm
|
2024-01-13 08:15:51 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "rutabaga_gfx";
|
|
|
|
version = "0.1.2";
|
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://chromium.googlesource.com/crosvm/crosvm";
|
|
|
|
rev = "v${finalAttrs.version}-rutabaga-release";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
hash = "sha256-0RJDKzeU7U6hc6CLKks8QcRs3fxN+/LYUbB0t6W790M=";
|
|
|
|
};
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
patches = [
|
|
|
|
# Make gfxstream optional
|
|
|
|
# https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4860836
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://chromium.googlesource.com/crosvm/crosvm/+/c3ad0e43eb12cbf737a6049e0134d483e337363f%5E%21/?format=TEXT";
|
|
|
|
decode = "base64 -d";
|
|
|
|
hash = "sha256-Ji1bK7jnRlg0OpDfCLcTHfPSiz3zYcdgsWL4n3EoIYI=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeBuildInputs = [ cargo pkg-config rustPlatform.cargoSetupHook ];
|
2024-01-25 14:12:00 +00:00
|
|
|
buildInputs = lib.optionals (lib.meta.availableOn stdenv.hostPlatform gfxstream) ([
|
|
|
|
aemu
|
|
|
|
gfxstream
|
|
|
|
] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform libdrm) [
|
|
|
|
libdrm
|
|
|
|
]);
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit (finalAttrs) src;
|
|
|
|
hash = "sha256-wuF3Isrp+u5J8jPQoPsIOWYGNKLSNa2pLfvladAWkLs=";
|
|
|
|
};
|
|
|
|
|
|
|
|
# make install always rebuilds
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
makeFlags = [ "prefix=$(out)" ];
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
cd rutabaga_gfx/ffi
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://crosvm.dev/book/appendix/rutabaga_gfx.html";
|
|
|
|
description = "cross-platform abstraction for GPU and display virtualization";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ qyliss ];
|
|
|
|
platforms = platforms.darwin ++ platforms.linux;
|
|
|
|
};
|
|
|
|
})
|