From 4fd353c08facc5b04a883a37c63e0de88e1db4eb Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Mon, 26 Aug 2024 17:36:13 -0400 Subject: [PATCH] yarg: init at 0.12.6 --- pkgs/by-name/ya/yarg/package.nix | 126 +++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 pkgs/by-name/ya/yarg/package.nix diff --git a/pkgs/by-name/ya/yarg/package.nix b/pkgs/by-name/ya/yarg/package.nix new file mode 100644 index 000000000000..47c179af860f --- /dev/null +++ b/pkgs/by-name/ya/yarg/package.nix @@ -0,0 +1,126 @@ +{ + lib, + stdenv, + fetchzip, + autoPatchelfHook, + alsa-lib, + gtk3, + zlib, + dbus, + hidapi, + libGL, + libXcursor, + libXext, + libXi, + libXinerama, + libxkbcommon, + libXrandr, + libXScrnSaver, + libXxf86vm, + udev, + vulkan-loader, + wayland, # (not used by default, enable with SDL_VIDEODRIVER=wayland - doesn't support HiDPI) + makeDesktopItem, + nix-update-script, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "yarg"; + version = "0.12.6"; + + src = fetchzip { + url = "https://github.com/YARC-Official/YARG/releases/download/v${finalAttrs.version}/YARG_v${finalAttrs.version}-Linux-x86_64.zip"; + stripRoot = false; + hash = "sha256-Za+CnuSTfJZVdW0pWvGDnKcbhZsgtNPRWYj1qOA8+Zs="; + }; + + nativeBuildInputs = [ autoPatchelfHook ]; + + buildInputs = [ + # Load-time libraries (loaded from DT_NEEDED section in ELF binary) + alsa-lib + gtk3 + stdenv.cc.cc.lib + zlib + + # Run-time libraries (loaded with dlopen) + dbus + hidapi + libGL + libXcursor + libXext + libXi + libXinerama + libxkbcommon + libXrandr + libXScrnSaver + libXxf86vm + udev + vulkan-loader + wayland + ]; + + desktopItem = makeDesktopItem { + name = "yarg"; + desktopName = "YARG"; + comment = finalAttrs.meta.description; + icon = "yarg"; + exec = "yarg"; + categories = [ "Game" ]; + }; + + installPhase = '' + runHook preInstall + + install -Dm755 YARG "$out/bin/yarg" + install -Dm644 UnityPlayer.so "$out/libexec/yarg/UnityPlayer.so" + + mkdir -p "$out/share/pixmaps" + cp -r YARG_Data "$out/share/yarg" + ln -s "$out/share/yarg" "$out/bin/yarg_Data" + ln -s "$out/share/yarg/Resources/UnityPlayer.png" "$out/share/pixmaps/yarg.png" + install -Dm644 "$desktopItem/share/applications/yarg.desktop" "$out/share/applications/yarg.desktop" + + runHook postInstall + ''; + + # Patch required run-time libraries as load-time libraries + # + # Libraries found with: + # > strings UnityPlayer.so | grep '\.so' + # and: + # > LD_DEBUG=libs yarg + postFixup = '' + patchelf \ + --add-needed libasound.so.2 \ + --add-needed libdbus-1.so.3 \ + --add-needed libGL.so.1 \ + --add-needed libhidapi-hidraw.so.0 \ + --add-needed libpthread.so.0 \ + --add-needed libudev.so.1 \ + --add-needed libvulkan.so.1 \ + --add-needed libwayland-client.so.0 \ + --add-needed libwayland-cursor.so.0 \ + --add-needed libwayland-egl.so.1 \ + --add-needed libX11.so.6 \ + --add-needed libXcursor.so.1 \ + --add-needed libXext.so.6 \ + --add-needed libXi.so.6 \ + --add-needed libXinerama.so.1 \ + --add-needed libxkbcommon.so.0 \ + --add-needed libXrandr.so.2 \ + --add-needed libXss.so.1 \ + --add-needed libXxf86vm.so.1 \ + "$out/libexec/yarg/UnityPlayer.so" + ''; + + passthru.updateScript = nix-update-script { }; + + meta = with lib; { + description = "Free, open-source, plastic guitar game"; + homepage = "https://yarg.in"; + license = licenses.lgpl3Plus; + maintainers = with maintainers; [ kira-bruneau ]; + platforms = [ "x86_64-linux" ]; + }; +})