From 62a26a94a11774b7c14ea10cde0ca2294990fb9b Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 2 Oct 2023 19:28:20 -0400 Subject: pkgs/modrinth-app: refactor wrapper --- pkgs/modrinth-app/default.nix | 11 +++--- pkgs/modrinth-app/wrapper.nix | 86 ++++++++++++++++++++++++------------------- 2 files changed, 54 insertions(+), 43 deletions(-) diff --git a/pkgs/modrinth-app/default.nix b/pkgs/modrinth-app/default.nix index 0250221..097dffa 100644 --- a/pkgs/modrinth-app/default.nix +++ b/pkgs/modrinth-app/default.nix @@ -23,17 +23,16 @@ openssl, pkg-config, webkitgtk, - wrapGAppsHook, }: rustPlatform.buildRustPackage rec { pname = "modrinth-app"; - version = "unstable-2023-09-12"; + version = "unstable-2023-10-02"; src = fetchFromGitHub { owner = "modrinth"; repo = "theseus"; - rev = "1e8852b54007f8739d94c4593aa369ac512b30fc"; - sha256 = "sha256-lL5zWeQHHo0o3H2iMYoR4b38f8/vZah6xzQOa3nh0/8="; + rev = "f73c112e078a4776be90b1ee82050b51683b5041"; + sha256 = "sha256-ArQe66siXDhs18Wvvdv+jxQTN+g5IWUX+G3lLcHvbaQ="; }; cargoLock = { @@ -70,7 +69,7 @@ rustPlatform.buildRustPackage rec { dontFixup = true; outputHashMode = "recursive"; - outputHash = "sha256-8Qk2eqMws5kJ0Yn9JSwaiw1KFNpUaJ1wR9B+DE/fnFw="; + outputHash = "sha256-gRQfWrAY/2XxiVSHtQd4YKruJWjkpAB5OsXZMmV0iDs="; }; buildInputs = @@ -90,7 +89,6 @@ rustPlatform.buildRustPackage rec { pkg-config pnpm copyDesktopItems - wrapGAppsHook ]; ESBUILD_BINARY_PATH = "${lib.getExe (esbuild.override { @@ -146,6 +144,7 @@ rustPlatform.buildRustPackage rec { ''; meta = with lib; { + mainProgram = "theseus_gui"; description = "Modrinth's future game launcher"; longDescription = '' Modrinth's future game launcher which can be used as a CLI, GUI, and a library for creating and playing Modrinth projects. diff --git a/pkgs/modrinth-app/wrapper.nix b/pkgs/modrinth-app/wrapper.nix index 419340e..843f499 100644 --- a/pkgs/modrinth-app/wrapper.nix +++ b/pkgs/modrinth-app/wrapper.nix @@ -4,52 +4,64 @@ symlinkJoin, modrinth-app-unwrapped, wrapGAppsHook, + addOpenGLRunpath, flite, glib-networking, - glfw, jdk8, jdk17, jdks ? [jdk8 jdk17], libGL, libpulseaudio, - openal, + udev, xorg, -}: let - final = modrinth-app-unwrapped; -in - symlinkJoin { - name = "modrinth-app-${final.version}"; +}: +symlinkJoin { + name = "modrinth-app-${modrinth-app-unwrapped.version}"; - paths = [final]; + paths = [modrinth-app-unwrapped]; - nativeBuildInputs = [ - wrapGAppsHook + buildInputs = [ + glib-networking + ]; + + nativeBuildInputs = [ + wrapGAppsHook + ]; + + postBuild = let + libPath = lib.makeLibraryPath [ + flite # narrator support + libGL + libpulseaudio + stdenv.cc.cc.lib + + udev # oshi + + # lwjgl + xorg.libX11 + xorg.libXcursor + xorg.libXext + xorg.libXxf86vm + xorg.libXrandr ]; - preFixup = let - libPath = lib.makeLibraryPath ([ - flite - glfw - libGL - libpulseaudio - openal - stdenv.cc.cc.lib - ] - ++ (with xorg; [ - libX11 - libXcursor - libXext - libXxf86vm - libXrandr - ])); - binPath = lib.makeBinPath (lib.optionals stdenv.isLinux [xorg.xrandr] ++ jdks); - in '' - gappsWrapperArgs+=( - ${lib.optionalString stdenv.isLinux "--set LD_LIBRARY_PATH /run/opengl-driver/lib:${libPath}"} - ${lib.optionalString stdenv.isLinux "--prefix GIO_MODULE_DIR : ${glib-networking}/lib/gio/modules/"} - --prefix PATH : ${binPath} - ) - ''; - - inherit (final) meta; - } + binPath = lib.makeBinPath ( + lib.optionals stdenv.isLinux [xorg.xrandr] + ); + + args = + ["--prefix PATH : ${lib.makeSearchPath "bin/java" jdks}"] + ++ lib.optionals stdenv.isLinux [ + "--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${libPath}" + "--prefix PATH : ${binPath}" + ]; + in '' + gappsWrapperArgs+=( + ${lib.concatStringsSep "\n" args} + ) + + wrapGAppsHook + ''; + + inherit (modrinth-app-unwrapped) meta; +} -- cgit v1.2.3