nixpkgs/pkgs/by-name/ru/rutabaga_gfx/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

82 lines
2.4 KiB
Nix

{ lib
, stdenv
, fetchgit
, fetchpatch
, cargo
, pkg-config
, rustPlatform
, aemu
, gfxstream
, libdrm
, libiconv
}:
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=";
};
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=";
})
# Fix error in Makefile where it uses eight spaces instead of a tab
# https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4863380
(fetchpatch {
url = "https://chromium.googlesource.com/crosvm/crosvm/+/fc415bccc43d36f63a2fd4c28878591bb1053450%5E%21/?format=TEXT";
decode = "base64 -d";
hash = "sha256-SLzlZ4o1+R2bGTPvA0a5emq97hOIIIHrubFhcQjqYwg=";
})
# Install the dylib on Darwin.
./darwin-install.patch
];
nativeBuildInputs = [ cargo pkg-config rustPlatform.cargoSetupHook ];
buildInputs = [ libiconv ] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform gfxstream) ([
aemu
gfxstream
] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform libdrm) [
libdrm
]);
cargoDeps = rustPlatform.fetchCargoTarball {
inherit (finalAttrs) src;
hash = "sha256-wuF3Isrp+u5J8jPQoPsIOWYGNKLSNa2pLfvladAWkLs=";
};
CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTargetSpec;
"CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_LINKER" =
"${stdenv.cc.targetPrefix}cc";
postConfigure = ''
cd rutabaga_gfx/ffi
substituteInPlace Makefile --replace-fail pkg-config "$PKG_CONFIG"
'';
# make install always rebuilds
dontBuild = true;
makeFlags = [
"prefix=$(out)"
"OUT=target/${stdenv.hostPlatform.rust.cargoShortTarget}/release"
];
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;
};
})