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 ] 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/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/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 273b0e80495b..75c063549395 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -20472,6 +20472,8 @@ with pkgs; adslib = callPackage ../development/libraries/adslib { }; + aemu = callPackage ../development/libraries/aemu { }; + afflib = callPackage ../development/libraries/afflib { }; aften = callPackage ../development/libraries/aften { }; @@ -21437,6 +21439,8 @@ with pkgs; gf2x = callPackage ../development/libraries/gf2x { }; + gfxstream = callPackage ../development/libraries/gfxstream { }; + gd = callPackage ../development/libraries/gd { automake = automake115x; }; @@ -24826,6 +24830,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 { };