about summary refs log tree commit diff
path: root/pkgs/development/libraries/rutabaga_gfx/default.nix
blob: ca220bb6ecc41855aac8c9cfd8c857d40fea504b (plain) (blame)
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
{ lib, stdenv, fetchgit, cargo, pkg-config, rustPlatform
, aemu, gfxstream, libcap, libdrm, minijail
}:

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=";
  };

  nativeBuildInputs = [ cargo pkg-config rustPlatform.cargoSetupHook ];
  buildInputs = [ aemu gfxstream ]
    ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform libdrm) libdrm;

  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;
  };
})