From 75370d69d3acc096a55b94a525eab7b574b467b1 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sun, 15 Dec 2024 02:57:39 -0800 Subject: [PATCH] fix: add extra wrapper vars for modrinth app to avoid segfault --- pkgs/by-name/modrinth-app/default.nix | 94 +++++++++++++++++++++++++++ pkgs/default.nix | 3 +- 2 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/modrinth-app/default.nix diff --git a/pkgs/by-name/modrinth-app/default.nix b/pkgs/by-name/modrinth-app/default.nix new file mode 100644 index 0000000..d790923 --- /dev/null +++ b/pkgs/by-name/modrinth-app/default.nix @@ -0,0 +1,94 @@ +{ + lib, + stdenv, + addDriverRunpath, + alsa-lib, + flite, + glib-networking, + jdk17, + jdk21, + jdk8, + jdks ? [ + jdk8 + jdk17 + jdk21 + ], + libGL, + libjack2, + libpulseaudio, + modrinth-app-unwrapped, + pipewire, + symlinkJoin, + udev, + wrapGAppsHook4, + xorg, +}: + +symlinkJoin rec { + name = "${pname}-${version}"; + pname = "modrinth-app"; + inherit (modrinth-app-unwrapped) version; + + paths = [ modrinth-app-unwrapped ]; + + nativeBuildInputs = [ wrapGAppsHook4 ]; + + buildInputs = [ glib-networking ]; + + runtimeDependencies = lib.optionalString stdenv.hostPlatform.isLinux ( + lib.makeLibraryPath [ + addDriverRunpath.driverLink + + # glfw + libGL + xorg.libX11 + xorg.libXcursor + xorg.libXext + xorg.libXrandr + xorg.libXxf86vm + + # lwjgl + (lib.getLib stdenv.cc.cc) + + # narrator support + flite + + # openal + alsa-lib + libjack2 + libpulseaudio + pipewire + + # oshi + udev + ] + ); + + postBuild = '' + gappsWrapperArgs+=( + --prefix PATH : ${lib.makeSearchPath "bin/java" jdks} + ${lib.optionalString stdenv.hostPlatform.isLinux '' + --prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]} + --set LD_LIBRARY_PATH $runtimeDependencies + --set GDK_BACKEND x11 + --set WEBKIT_DISABLE_DMABUF_RENDERER 1 + ''} + ) + + wrapGAppsHook + ''; + # fixes nvidia broken modrinth + + meta = { + inherit (modrinth-app-unwrapped.meta) + description + longDescription + homepage + license + maintainers + mainProgram + platforms + broken + ; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index dbbd5a2..8bbf15a 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -3,6 +3,5 @@ let inherit (pkgs) callPackage; in final: prev: { - zen-browser-unwrapped = callPackage ./by-name/zen-browser-unwrapped/package.nix { }; - zen-browser = callPackage ./by-name/zen-browser/package.nix { }; + modrinth-app = callPackage ./by-name/modrinth-app { }; }