From b71f407527b38c3af16c2330c77c9b4aca98843f Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 1 Aug 2023 19:04:49 +0000 Subject: [PATCH 1/4] aemu: init at 0.1.2 (cherry picked from commit 9cce064d4aff9b587460654a0b05c8219b0732b7) --- pkgs/development/libraries/aemu/default.nix | 33 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 pkgs/development/libraries/aemu/default.nix diff --git a/pkgs/development/libraries/aemu/default.nix b/pkgs/development/libraries/aemu/default.nix new file mode 100644 index 000000000000..3ee8e5eca6f1 --- /dev/null +++ b/pkgs/development/libraries/aemu/default.nix @@ -0,0 +1,33 @@ +{ lib, stdenv, fetchFromGitiles, cmake, darwin }: + +stdenv.mkDerivation { + pname = "aemu"; + version = "0.1.2"; + + src = fetchFromGitiles { + url = "https://android.googlesource.com/platform/hardware/google/aemu"; + rev = "07ccc3ded3357e67e39104f18f35feaf8b3b6a0e"; + hash = "sha256-H3IU9aTFSzUAqYgrtHd4F18hbhZsbOJGC4K5JwMQOOw="; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Cocoa + ]; + + cmakeFlags = [ + "-DAEMU_COMMON_GEN_PKGCONFIG=ON" + "-DAEMU_COMMON_BUILD_CONFIG=gfxstream" + # "-DENABLE_VKCEREAL_TESTS=OFF" + ]; + + meta = with lib; { + homepage = "https://android.googlesource.com/platform/hardware/google/aemu"; + description = "Android emulation utilities library"; + maintainers = with maintainers; [ qyliss ]; + # The BSD license comes from host-common/VpxFrameParser.cpp, which + # incorporates some code from libvpx, which uses the 3-clause BSD license. + license = with licenses; [ asl20 mit bsd3 ]; + platforms = platforms.darwin ++ platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5670bbec2d83..5ef3c4b0ad63 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -20486,6 +20486,8 @@ with pkgs; adslib = callPackage ../development/libraries/adslib { }; + aemu = callPackage ../development/libraries/aemu { }; + afflib = callPackage ../development/libraries/afflib { }; aften = callPackage ../development/libraries/aften { }; From e31df9c9d7fce4b15c806d88e108bf7c3ccbd481 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 1 Aug 2023 19:08:08 +0000 Subject: [PATCH 2/4] gfxstream: init at 0.1.2 (cherry picked from commit 0ee4d9ea9bb88ba0a1d609e4a7bf6954191df0cd) --- .../libraries/gfxstream/default.nix | 34 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 36 insertions(+) create mode 100644 pkgs/development/libraries/gfxstream/default.nix diff --git a/pkgs/development/libraries/gfxstream/default.nix b/pkgs/development/libraries/gfxstream/default.nix new file mode 100644 index 000000000000..bb88fe9f8496 --- /dev/null +++ b/pkgs/development/libraries/gfxstream/default.nix @@ -0,0 +1,34 @@ +{ lib, stdenv, fetchFromGitiles, meson, ninja, pkg-config, python3 +, aemu, libdrm, libglvnd, vulkan-headers, vulkan-loader, xorg +}: + +stdenv.mkDerivation { + pname = "gfxstream"; + version = "0.1.2"; + + src = fetchFromGitiles { + url = "https://android.googlesource.com/platform/hardware/google/gfxstream"; + rev = "a29282666c0e2fdbb2c98cfe68a7c0677163ef91"; + hash = "sha256-IYXkaHZPEYIE9KW731GN6x6yRS+FYtP1zyHcaSofhIM="; + }; + + nativeBuildInputs = [ meson ninja pkg-config python3 ]; + buildInputs = [ aemu libglvnd vulkan-headers vulkan-loader xorg.libX11 ] + ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform libdrm) libdrm; + + # dlopens libvulkan. + # + # XXX: Unsure if this is required on Darwin. If it is, it probably + # needs to be done using install_name_tool. + preConfigure = lib.optionalString (!stdenv.isDarwin) '' + mesonFlagsArray=(-Dcpp_link_args="-Wl,--push-state -Wl,--no-as-needed -lvulkan -Wl,--pop-state") + ''; + + meta = with lib; { + homepage = "https://android.googlesource.com/platform/hardware/google/gfxstream"; + description = "Graphics Streaming Kit"; + license = licenses.free; # https://android.googlesource.com/platform/hardware/google/gfxstream/+/refs/heads/main/LICENSE + maintainers = with maintainers; [ qyliss ]; + platforms = platforms.darwin ++ platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5ef3c4b0ad63..50fb838053a9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21458,6 +21458,8 @@ with pkgs; gf2x = callPackage ../development/libraries/gf2x { }; + gfxstream = callPackage ../development/libraries/gfxstream { }; + gd = callPackage ../development/libraries/gd { automake = automake115x; }; From 28257606653cef6913d4ccd76ead276f050507e1 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 1 Aug 2023 19:08:53 +0000 Subject: [PATCH 3/4] rutabaga_gfx: init at 0.1.2 (cherry picked from commit a8c49d6e2801627f97e0b4ceda1ccd4bf4ec8698) --- .../libraries/rutabaga_gfx/default.nix | 41 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 43 insertions(+) create mode 100644 pkgs/development/libraries/rutabaga_gfx/default.nix diff --git a/pkgs/development/libraries/rutabaga_gfx/default.nix b/pkgs/development/libraries/rutabaga_gfx/default.nix new file mode 100644 index 000000000000..ca220bb6ecc4 --- /dev/null +++ b/pkgs/development/libraries/rutabaga_gfx/default.nix @@ -0,0 +1,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; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 50fb838053a9..f4985c45c403 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24852,6 +24852,8 @@ with pkgs; rubberband = callPackage ../development/libraries/rubberband { }; + rutabaga_gfx = callPackage ../development/libraries/rutabaga_gfx { }; + rure = callPackage ../development/libraries/rure { }; rustc-demangle = callPackage ../development/libraries/rustc-demangle { }; From b4db0582a1d6c964b30c223c0424de8463801ce5 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 6 Jan 2024 18:43:14 +0100 Subject: [PATCH 4/4] qemu: add rutabaga support --- pkgs/applications/virtualization/qemu/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix index 1cdd9f07337a..4278c08f9c6b 100644 --- a/pkgs/applications/virtualization/qemu/default.nix +++ b/pkgs/applications/virtualization/qemu/default.nix @@ -23,6 +23,7 @@ , cephSupport ? false, ceph , glusterfsSupport ? false, glusterfs, libuuid , openGLSupport ? sdlSupport, mesa, libepoxy, libdrm +, rutabagaSupport ? openGLSupport && !toolsOnly, rutabaga_gfx , virglSupport ? openGLSupport, virglrenderer , libiscsiSupport ? !toolsOnly, libiscsi , smbdSupport ? false, samba @@ -98,6 +99,7 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optionals cephSupport [ ceph ] ++ lib.optionals glusterfsSupport [ glusterfs libuuid ] ++ lib.optionals openGLSupport [ mesa libepoxy libdrm ] + ++ lib.optionals rutabagaSupport [ rutabaga_gfx ] ++ lib.optionals virglSupport [ virglrenderer ] ++ lib.optionals libiscsiSupport [ libiscsi ] ++ lib.optionals smbdSupport [ samba ]