From 58d045414a13e7c8d966ef95c52de96e3b3b9a1a Mon Sep 17 00:00:00 2001 From: Jasi Date: Sat, 20 Sep 2025 20:32:01 -0400 Subject: [PATCH] duckstation: 0.1-7465 -> 0.1-9669; duckstation-bin: remove --- doc/release-notes/rl-2511.section.md | 2 + pkgs/by-name/du/duckstation-bin/package.nix | 45 -- pkgs/by-name/du/duckstation-bin/update.sh | 20 - .../duckstation/001-fix-test-inclusion.diff | 11 - .../du/duckstation/002-hardcode-vars.diff | 19 - .../duckstation/003-fix-NEON-intrinsics.patch | 70 --- pkgs/by-name/du/duckstation/package.nix | 436 ++++++++++++------ .../du/duckstation/remove-cubeb-vendor.patch | 33 -- .../du/duckstation/shaderc-patched.nix | 20 - pkgs/by-name/du/duckstation/sources.json | 20 + pkgs/by-name/du/duckstation/sources.nix | 166 ------- pkgs/by-name/du/duckstation/update.sh | 77 ++++ pkgs/top-level/aliases.nix | 1 + 13 files changed, 403 insertions(+), 517 deletions(-) delete mode 100644 pkgs/by-name/du/duckstation-bin/package.nix delete mode 100755 pkgs/by-name/du/duckstation-bin/update.sh delete mode 100644 pkgs/by-name/du/duckstation/001-fix-test-inclusion.diff delete mode 100644 pkgs/by-name/du/duckstation/002-hardcode-vars.diff delete mode 100644 pkgs/by-name/du/duckstation/003-fix-NEON-intrinsics.patch delete mode 100644 pkgs/by-name/du/duckstation/remove-cubeb-vendor.patch delete mode 100644 pkgs/by-name/du/duckstation/shaderc-patched.nix create mode 100644 pkgs/by-name/du/duckstation/sources.json delete mode 100644 pkgs/by-name/du/duckstation/sources.nix create mode 100755 pkgs/by-name/du/duckstation/update.sh diff --git a/doc/release-notes/rl-2511.section.md b/doc/release-notes/rl-2511.section.md index 9efc0c54c3a9..c1e01105f417 100644 --- a/doc/release-notes/rl-2511.section.md +++ b/doc/release-notes/rl-2511.section.md @@ -84,6 +84,8 @@ - `spidermonkey_91` has been removed, as it has been EOL since September 2022. +- The license of duckstation has changed from `gpl3Only` to `cc-by-nc-nd-40` making it unfree in newer releases. The `duckstation` package has been overhauled to support the new releases and `duckstation-bin` has been aliased to `duckstation` to support darwin binary builds. + - `hiawata` has been removed, due to lack of active development upstream, lack of maintainership downstream and upcoming security issues. - `forgejo` main program has been renamed to `bin/forgejo` from the previous `bin/gitea`. diff --git a/pkgs/by-name/du/duckstation-bin/package.nix b/pkgs/by-name/du/duckstation-bin/package.nix deleted file mode 100644 index 8349b98ef84f..000000000000 --- a/pkgs/by-name/du/duckstation-bin/package.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - lib, - stdenvNoCC, - fetchurl, - unzip, -}: - -stdenvNoCC.mkDerivation (finalAttrs: { - pname = "duckstation-bin"; - version = "0.1-7371"; - - src = fetchurl { - url = "https://github.com/stenzek/duckstation/releases/download/v${finalAttrs.version}/duckstation-mac-release.zip"; - hash = "sha256-ukORbTG0lZIsUInkEnyPB9+PwFxxK5hbgj9D6tjOEAY="; - }; - - nativeBuildInputs = [ unzip ]; - - dontPatch = true; - dontConfigure = true; - dontBuild = true; - - sourceRoot = "."; - - installPhase = '' - runHook preInstall - mkdir -p $out/Applications - cp -r DuckStation.app $out/Applications/DuckStation.app - runHook postInstall - ''; - - passthru = { - updateScript = ./update.sh; - }; - - meta = { - homepage = "https://github.com/stenzek/duckstation"; - description = "Fast PlayStation 1 emulator for x86-64/AArch32/AArch64"; - changelog = "https://github.com/stenzek/duckstation/releases/tag/v${finalAttrs.version}"; - license = lib.licenses.gpl3Only; - maintainers = with lib.maintainers; [ matteopacini ]; - platforms = lib.platforms.darwin; - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - }; -}) diff --git a/pkgs/by-name/du/duckstation-bin/update.sh b/pkgs/by-name/du/duckstation-bin/update.sh deleted file mode 100755 index 50d6017f7ccc..000000000000 --- a/pkgs/by-name/du/duckstation-bin/update.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p curl jq gnused - -set -euo pipefail - -cd "$(dirname "$0")" || exit 1 - -# Grab latest version, ignoring "latest" and "preview" tags -LATEST_VER="$(curl --fail -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} "https://api.github.com/repos/stenzek/duckstation/releases" | jq -r '.[].tag_name' | grep '^v' | head -n 1 | sed 's/^v//')" -CURRENT_VER="$(grep -oP 'version = "\K[^"]+' package.nix)" - -if [[ "$LATEST_VER" == "$CURRENT_VER" ]]; then - echo "duckstation-bin is up-to-date" - exit 0 -fi - -HASH="$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url --type sha256 "https://github.com/stenzek/duckstation/releases/download/v${LATEST_VER}/duckstation-mac-release.zip")")" - -sed -i "s#hash = \".*\"#hash = \"$HASH\"#g" package.nix -sed -i "s#version = \".*\";#version = \"$LATEST_VER\";#g" package.nix diff --git a/pkgs/by-name/du/duckstation/001-fix-test-inclusion.diff b/pkgs/by-name/du/duckstation/001-fix-test-inclusion.diff deleted file mode 100644 index b2dabe0262db..000000000000 --- a/pkgs/by-name/du/duckstation/001-fix-test-inclusion.diff +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 879d46bc..95570f6b 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -20,5 +20,5 @@ if(BUILD_REGTEST) - endif() - - if(BUILD_TESTS) -- add_subdirectory(common-tests EXCLUDE_FROM_ALL) -+ add_subdirectory(common-tests) - endif() diff --git a/pkgs/by-name/du/duckstation/002-hardcode-vars.diff b/pkgs/by-name/du/duckstation/002-hardcode-vars.diff deleted file mode 100644 index edba33fce7ce..000000000000 --- a/pkgs/by-name/du/duckstation/002-hardcode-vars.diff +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/src/scmversion/gen_scmversion.sh b/src/scmversion/gen_scmversion.sh -index 9122cd8..50ed8f9 100755 ---- a/src/scmversion/gen_scmversion.sh -+++ b/src/scmversion/gen_scmversion.sh -@@ -10,10 +10,10 @@ else - fi - - --HASH=$(git rev-parse HEAD) --BRANCH=$(git rev-parse --abbrev-ref HEAD | tr -d '\r\n') --TAG=$(git describe --dirty | tr -d '\r\n') --DATE=$(git log -1 --date=iso8601-strict --format=%cd) -+HASH="@gitHash@" -+BRANCH="@gitBranch@" -+TAG="@gitTag@" -+DATE="@gitDate@" - - cd $CURDIR - diff --git a/pkgs/by-name/du/duckstation/003-fix-NEON-intrinsics.patch b/pkgs/by-name/du/duckstation/003-fix-NEON-intrinsics.patch deleted file mode 100644 index 571a15d4aad6..000000000000 --- a/pkgs/by-name/du/duckstation/003-fix-NEON-intrinsics.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 19e094e5c7aaaf375a13424044521701e85c8313 Mon Sep 17 00:00:00 2001 -From: OPNA2608 -Date: Thu, 9 Jan 2025 17:46:25 +0100 -Subject: [PATCH] Fix usage of NEON intrinsics - ---- - src/common/gsvector_neon.h | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/src/common/gsvector_neon.h b/src/common/gsvector_neon.h -index e4991af5e..61b8dc09b 100644 ---- a/src/common/gsvector_neon.h -+++ b/src/common/gsvector_neon.h -@@ -867,7 +867,7 @@ public: - - ALWAYS_INLINE int mask() const - { -- const uint32x2_t masks = vshr_n_u32(vreinterpret_u32_s32(v2s), 31); -+ const uint32x2_t masks = vshr_n_u32(vreinterpret_u32_f32(v2s), 31); - return (vget_lane_u32(masks, 0) | (vget_lane_u32(masks, 1) << 1)); - } - -@@ -2882,7 +2882,7 @@ public: - ALWAYS_INLINE GSVector4 gt64(const GSVector4& v) const - { - #ifdef CPU_ARCH_ARM64 -- return GSVector4(vreinterpretq_f32_f64(vcgtq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); -+ return GSVector4(vreinterpretq_f32_u64(vcgtq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); - #else - GSVector4 ret; - ret.U64[0] = (F64[0] > v.F64[0]) ? 0xFFFFFFFFFFFFFFFFULL : 0; -@@ -2894,7 +2894,7 @@ public: - ALWAYS_INLINE GSVector4 eq64(const GSVector4& v) const - { - #ifdef CPU_ARCH_ARM64 -- return GSVector4(vreinterpretq_f32_f64(vceqq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); -+ return GSVector4(vreinterpretq_f32_u64(vceqq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); - #else - GSVector4 ret; - ret.U64[0] = (F64[0] == v.F64[0]) ? 0xFFFFFFFFFFFFFFFFULL : 0; -@@ -2906,7 +2906,7 @@ public: - ALWAYS_INLINE GSVector4 lt64(const GSVector4& v) const - { - #ifdef CPU_ARCH_ARM64 -- return GSVector4(vreinterpretq_f32_f64(vcgtq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); -+ return GSVector4(vreinterpretq_f32_u64(vcgtq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); - #else - GSVector4 ret; - ret.U64[0] = (F64[0] < v.F64[0]) ? 0xFFFFFFFFFFFFFFFFULL : 0; -@@ -2918,7 +2918,7 @@ public: - ALWAYS_INLINE GSVector4 ge64(const GSVector4& v) const - { - #ifdef CPU_ARCH_ARM64 -- return GSVector4(vreinterpretq_f32_f64(vcgeq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); -+ return GSVector4(vreinterpretq_f32_u64(vcgeq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); - #else - GSVector4 ret; - ret.U64[0] = (F64[0] >= v.F64[0]) ? 0xFFFFFFFFFFFFFFFFULL : 0; -@@ -2930,7 +2930,7 @@ public: - ALWAYS_INLINE GSVector4 le64(const GSVector4& v) const - { - #ifdef CPU_ARCH_ARM64 -- return GSVector4(vreinterpretq_f32_f64(vcleq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); -+ return GSVector4(vreinterpretq_f32_u64(vcleq_f64(vreinterpretq_f64_f32(v4s), vreinterpretq_f64_f32(v.v4s)))); - #else - GSVector4 ret; - ret.U64[0] = (F64[0] <= v.F64[0]) ? 0xFFFFFFFFFFFFFFFFULL : 0; --- -2.47.0 - diff --git a/pkgs/by-name/du/duckstation/package.nix b/pkgs/by-name/du/duckstation/package.nix index c84a3cdf5a0f..05232359446d 100644 --- a/pkgs/by-name/du/duckstation/package.nix +++ b/pkgs/by-name/du/duckstation/package.nix @@ -1,147 +1,317 @@ { lib, - stdenv, llvmPackages, - SDL2, - callPackage, + stdenvNoCC, + fetchFromGitHub, cmake, - cpuinfo, - cubeb, - curl, - extra-cmake-modules, - libXrandr, - libbacktrace, - libwebp, - makeWrapper, - ninja, pkg-config, - qt6, - vulkan-loader, - wayland, + ninja, + extra-cmake-modules, wayland-scanner, + makeBinaryWrapper, + qt6, + sdl3, + zstd, + libwebp, + zlib, + libpng, + libjpeg, + freetype, + plutosvg, + cpuinfo, + soundtouch, + rapidjson, + libzip, + curl, + libX11, + wayland, + shaderc, + spirv-cross, + udev, + libbacktrace, + ffmpeg-headless, + alsa-lib, + libjack2, + libpulseaudio, + pipewire, + fetchurl, + zip, + unzip, }: let - sources = callPackage ./sources.nix { }; - inherit (qt6) - qtbase - qtsvg - qttools - qtwayland - wrapQtAppsHook - ; -in -llvmPackages.stdenv.mkDerivation (finalAttrs: { - inherit (sources.duckstation) pname version src; - - patches = [ - # Tests are not built by default - ./001-fix-test-inclusion.diff - # Patching yet another script that fills data based on git commands . . . - ./002-hardcode-vars.diff - # Fix NEON intrinsics usage - ./003-fix-NEON-intrinsics.patch - ./remove-cubeb-vendor.patch - ]; - - nativeBuildInputs = [ - cmake - extra-cmake-modules - ninja - pkg-config - qttools - wayland-scanner - wrapQtAppsHook - ]; - - buildInputs = [ - SDL2 - cpuinfo - cubeb - curl - libXrandr - libbacktrace - libwebp - qtbase - qtsvg - qtwayland - sources.discord-rpc-patched - sources.lunasvg - sources.shaderc-patched - sources.soundtouch-patched - sources.spirv-cross-patched - wayland - ]; - - cmakeFlags = [ - (lib.cmakeBool "BUILD_TESTS" true) - ]; - - strictDeps = true; - - doInstallCheck = true; - - postPatch = '' - gitHash=$(cat .nixpkgs-auxfiles/git_hash) \ - gitBranch=$(cat .nixpkgs-auxfiles/git_branch) \ - gitTag=$(cat .nixpkgs-auxfiles/git_tag) \ - gitDate=$(cat .nixpkgs-auxfiles/git_date) \ - substituteAllInPlace src/scmversion/gen_scmversion.sh - ''; - - # error: cannot convert 'int16x8_t' to '__Int32x4_t' - env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isAarch64 "-flax-vector-conversions"; - - installCheckPhase = '' - runHook preInstallCheck - - $out/share/duckstation/common-tests - - runHook postInstallCheck - ''; - - installPhase = '' - runHook preInstall - - mkdir -p $out/bin $out/share - - cp -r bin $out/share/duckstation - ln -s $out/share/duckstation/duckstation-qt $out/bin/ - - install -Dm644 $src/scripts/org.duckstation.DuckStation.desktop $out/share/applications/org.duckstation.DuckStation.desktop - install -Dm644 $src/scripts/org.duckstation.DuckStation.png $out/share/pixmaps/org.duckstation.DuckStation.png - - runHook postInstall - ''; - - qtWrapperArgs = - let - libPath = lib.makeLibraryPath ([ - sources.shaderc-patched - sources.spirv-cross-patched - vulkan-loader - ]); - in - [ - "--prefix LD_LIBRARY_PATH : ${libPath}" - ]; - - # https://github.com/stenzek/duckstation/blob/master/scripts/appimage/apprun-hooks/default-to-x11.sh - # Can't avoid the double wrapping, the binary wrapper from qtWrapperArgs doesn't support --run - postFixup = '' - source "${makeWrapper}/nix-support/setup-hook" - wrapProgram $out/bin/duckstation-qt \ - --run 'if [[ -z $I_WANT_A_BROKEN_WAYLAND_UI ]]; then export QT_QPA_PLATFORM=xcb; fi' - ''; + passthru = { + updateScript = ./update.sh; + }; meta = { - homepage = "https://github.com/stenzek/duckstation"; - description = "Fast PlayStation 1 emulator for x86-64/AArch32/AArch64"; - license = lib.licenses.gpl3Only; - mainProgram = "duckstation-qt"; + description = "Fast PlayStation 1 emulator for x86-64/AArch32/AArch64/RV64"; + longDescription = '' + # DISCLAIMER + This is an **unofficial** package, do not report any issues to + duckstation developers. Instead, please report them to + or use the officially + supported platform build at or other + upstream-approved distribution mechanism not listed here. We + (nixpkgs) do not endorse or condone any action taken on your own + accord in regards to this package. + + The SDL audio backend must be used as cubeb support is currently + non-functional without patches. + ''; + homepage = "https://duckstation.org"; + license = lib.licenses.cc-by-nc-nd-40; maintainers = with lib.maintainers; [ - guibou + normalcea + matteopacini ]; - platforms = lib.platforms.linux; }; -}) + + pkgSources = lib.importJSON ./sources.json; + + linuxDrv = llvmPackages.stdenv.mkDerivation (finalAttrs: { + pname = "duckstation"; + version = pkgSources.duckstation.version; + + src = fetchFromGitHub { + owner = "stenzek"; + repo = "duckstation"; + tag = "v${finalAttrs.version}"; + hash = pkgSources.duckstation.hash_linux; + }; + + vendorDiscordRPC = llvmPackages.stdenv.mkDerivation { + pname = "discord-rpc-duckstation"; + inherit (finalAttrs) version; + src = fetchFromGitHub { + owner = "stenzek"; + repo = "discord-rpc"; + inherit (pkgSources.discord_rpc) rev hash; + }; + nativeBuildInputs = [ cmake ]; + buildInputs = [ rapidjson ]; + meta = { + license = lib.licenses.mit; + platforms = lib.platforms.linux; + }; + }; + + vendorShaderc = shaderc.overrideAttrs (oldAttrs: { + pname = "shaderc-duckstation"; + inherit (finalAttrs) version; + src = fetchFromGitHub { + owner = "stenzek"; + repo = "shaderc"; + inherit (pkgSources.shaderc) rev hash; + }; + + patches = (oldAttrs.patches or [ ]); + cmakeFlags = (oldAttrs.cmakeFlags or [ ]) ++ [ + (lib.cmakeBool "SHADERC_SKIP_EXAMPLES" true) + (lib.cmakeBool "SHADERC_SKIP_TESTS" true) + ]; + outputs = [ + "out" + "lib" + "dev" + ]; + postFixup = null; + }); + + soundtouch = llvmPackages.stdenv.mkDerivation { + inherit (soundtouch) + pname + version + src + meta + ; + nativeBuildInputs = [ cmake ]; + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace-fail "\''${prefix}/''${CMAKE_INSTALL_LIBDIR}" \ + "''${CMAKE_INSTALL_FULL_LIBDIR}" + ''; + + cmakeFlags = [ + (lib.cmakeBool "SOUNDTOUCH_DLL" true) + ]; + }; + + chtdb = stdenvNoCC.mkDerivation { + pname = "chtdb-duckstation"; + version = "0-unstable-${pkgSources.chtdb.date}"; + + src = fetchFromGitHub { + owner = "duckstation"; + repo = "chtdb"; + inherit (pkgSources.chtdb) rev hash; + }; + + nativeBuildInputs = [ + zip + ]; + + buildPhase = '' + runHook preBuild + + pushd cheats + zip -r cheats.zip *.cht + popd + pushd patches + zip -r patches.zip *.cht + popd + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + install -Dm644 cheats/cheats.zip -t $out/lib/duckstation + install -Dm644 patches/patches.zip -t $out/lib/duckstation + + install -Dm644 LICENSE -t $out/share/doc/duckstation + install -Dm644 README.md -t $out/share/doc/duckstation + + runHook postInstall + ''; + + meta = { + description = "Collection of cheats and patches for PSX games"; + longDescription = '' + Collection of cheats and patches for PSX games, primarily intended for + use with the DuckStation emulator, but can also be used by other + emulators that support GameShark codes. + + Patches show in the UI in a separate section to cheats, and are + intended for modifications to the game that do not provide any + "advantage" to the player, including: + + - Improving performance. + - Fixing game-breaking bugs. + - Unlocking the frame rate (e.g. "60 FPS patches"). + - Widescreen rendering where the built-in widescreen rendering rendering is insufficient. + ''; + license = lib.licenses.mit; + inherit (meta) maintainers; + platforms = lib.platforms.all; + }; + }; + + preConfigure = '' + cp ${finalAttrs.chtdb}/lib/duckstation/cheats.zip data/resources + cp ${finalAttrs.chtdb}/lib/duckstation/patches.zip data/resources + ''; + + nativeBuildInputs = [ + cmake + pkg-config + ninja + extra-cmake-modules + wayland-scanner + makeBinaryWrapper + qt6.wrapQtAppsHook + qt6.qttools + ]; + + buildInputs = [ + sdl3 + zstd + libwebp + zlib + libpng + libjpeg + freetype + plutosvg + cpuinfo + libzip + curl + libX11 + wayland + spirv-cross + qt6.qtbase + udev + libbacktrace + ffmpeg-headless + alsa-lib + libjack2 + pipewire + libpulseaudio + ] + ++ [ + finalAttrs.vendorDiscordRPC + finalAttrs.vendorShaderc + finalAttrs.soundtouch + ]; + + cmakeFlags = [ + (lib.cmakeBool "ALLOW_INSTALL" true) + (lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/lib/duckstation") + ]; + + postInstall = '' + makeWrapper $out/lib/duckstation/duckstation-qt $out/bin/duckstation-qt + + mkdir -p $out/share/applications + ln -s $out/lib/duckstation/resources/org.duckstation.DuckStation.desktop \ + $out/share/applications + + mkdir -p $out/share/icons/hicolor/512x512/apps + ln -s $out/lib/duckstation/resources/org.duckstation.DuckStation.png \ + $out/share/icons/hicolor/512x512/apps + + pushd .. + install -Dm644 LICENSE -t $out/share/doc/duckstation + install -Dm644 README.* -t $out/share/doc/duckstation + install -Dm644 CONTRIBUTORS.md -t $out/share/doc/duckstation + popd + ''; + + inherit passthru; + + meta = meta // { + mainProgram = "duckstation-qt"; + platforms = lib.platforms.linux; + }; + }); + + darwinDrv = stdenvNoCC.mkDerivation (finalAttrs: { + pname = "duckstation"; + version = pkgSources.duckstation.version; + + src = fetchurl { + url = "https://github.com/stenzek/duckstation/releases/download/v${finalAttrs.version}/duckstation-mac-release.zip"; + hash = pkgSources.duckstation.hash_darwin; + }; + + nativeBuildInputs = [ unzip ]; + + dontPatch = true; + dontConfigure = true; + dontBuild = true; + + sourceRoot = "."; + + installPhase = '' + runHook preInstall + + mkdir -p $out/Applications + cp -r DuckStation.app $out/Applications/DuckStation.app + + runHook postInstall + ''; + + inherit passthru; + + meta = meta // { + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + platforms = lib.platforms.darwin; + }; + }); +in +if stdenvNoCC.hostPlatform.isLinux then + linuxDrv +else if stdenvNoCC.hostPlatform.isDarwin then + darwinDrv +else + throw "duckstation is not supported on ${stdenvNoCC.hostPlatform.system}." diff --git a/pkgs/by-name/du/duckstation/remove-cubeb-vendor.patch b/pkgs/by-name/du/duckstation/remove-cubeb-vendor.patch deleted file mode 100644 index e740b0619338..000000000000 --- a/pkgs/by-name/du/duckstation/remove-cubeb-vendor.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt -index af35687..8347825 100644 ---- a/dep/CMakeLists.txt -+++ b/dep/CMakeLists.txt -@@ -22,9 +22,8 @@ add_subdirectory(rcheevos EXCLUDE_FROM_ALL) - disable_compiler_warnings_for_target(rcheevos) - add_subdirectory(rapidyaml EXCLUDE_FROM_ALL) - disable_compiler_warnings_for_target(rapidyaml) --add_subdirectory(cubeb EXCLUDE_FROM_ALL) --disable_compiler_warnings_for_target(cubeb) --disable_compiler_warnings_for_target(speex) -+find_package(cubeb REQUIRED GLOBAL) -+add_library(cubeb ALIAS cubeb::cubeb) - add_subdirectory(kissfft EXCLUDE_FROM_ALL) - disable_compiler_warnings_for_target(kissfft) - -diff --git a/src/util/cubeb_audio_stream.cpp b/src/util/cubeb_audio_stream.cpp -index 85579c4..339190a 100644 ---- a/src/util/cubeb_audio_stream.cpp -+++ b/src/util/cubeb_audio_stream.cpp -@@ -261,9 +261,9 @@ std::vector> AudioStream::GetCubebDriverName - std::vector> names; - names.emplace_back(std::string(), TRANSLATE_STR("AudioStream", "Default")); - -- const char** cubeb_names = cubeb_get_backend_names(); -- for (u32 i = 0; cubeb_names[i] != nullptr; i++) -- names.emplace_back(cubeb_names[i], cubeb_names[i]); -+ cubeb_backend_names backends = cubeb_get_backend_names(); -+ for (u32 i = 0; i < backends.count; i++) -+ names.emplace_back(backends.names[i], backends.names[i]); - return names; - } - diff --git a/pkgs/by-name/du/duckstation/shaderc-patched.nix b/pkgs/by-name/du/duckstation/shaderc-patched.nix deleted file mode 100644 index 3211925699e1..000000000000 --- a/pkgs/by-name/du/duckstation/shaderc-patched.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - fetchpatch, - duckstation, - shaderc, -}: - -shaderc.overrideAttrs (old: { - pname = "shaderc-patched-for-duckstation"; - patches = (old.patches or [ ]) ++ [ - (fetchpatch { - url = "file://${duckstation.src}/scripts/shaderc-changes.patch"; - hash = "sha256-Ps/D+CdSbjVWg3ZGOEcgbpQbCNkI5Nuizm4E5qiM9Wo="; - excludes = [ - "CHANGES" - "CMakeLists.txt" - "libshaderc/CMakeLists.txt" - ]; - }) - ]; -}) diff --git a/pkgs/by-name/du/duckstation/sources.json b/pkgs/by-name/du/duckstation/sources.json new file mode 100644 index 000000000000..dfca7c572752 --- /dev/null +++ b/pkgs/by-name/du/duckstation/sources.json @@ -0,0 +1,20 @@ +{ + "duckstation": { + "version": "0.1-9669", + "hash_linux": "sha256-Q3vU4PaHMHzA8MTxLQbR++ND4L0iRMw6M7J74jyWBKI=", + "hash_darwin": "sha256-qbY1xKqjYAoxU5EWSFRq8Quu3bZBHHsS8nqnLW3xT+k=" + }, + "discord_rpc": { + "rev": "cc59d26d1d628fbd6527aac0ac1d6301f4978b92", + "hash": "sha256-8xXcx5w36eiJqtWm6qQfhEHgchVJbhP/jR94eMNNjHU=" + }, + "shaderc": { + "rev": "4daf9d466ad00897f755163dd26f528d14e1db44", + "hash": "sha256-/o3LPYvMTlKhuvLQITnADmz8BTGXVaVR0aciOWVyFS8=" + }, + "chtdb": { + "date": "2025-10-05", + "rev": "eab12dde0ddfd03e1260d7111f2a0709144e047e", + "hash": "sha256-wRk9BijV52BCcvpeq4CzhLsaWYYrt+vFvdMwlAixBvU=" + } +} diff --git a/pkgs/by-name/du/duckstation/sources.nix b/pkgs/by-name/du/duckstation/sources.nix deleted file mode 100644 index 8261f08de9be..000000000000 --- a/pkgs/by-name/du/duckstation/sources.nix +++ /dev/null @@ -1,166 +0,0 @@ -{ - lib, - duckstation, - fetchFromGitHub, - fetchpatch, - shaderc, - spirv-cross, - discord-rpc, - stdenv, - cmake, - ninja, -}: - -{ - duckstation = - let - self = { - pname = "duckstation"; - version = "0.1-7465"; - src = fetchFromGitHub { - owner = "stenzek"; - repo = "duckstation"; - rev = "aa955b8ae28314ae061613f0ddf13183a98aca03"; - # - # Some files are filled by using Git commands; it requires deepClone. - # More info at `checkout_ref` function in nix-prefetch-git. - # However, `.git` is a bit nondeterministic (and Git itself makes no - # guarantees whatsoever). - # Then, in order to enhance reproducibility, what we will do here is: - # - # - Execute the desired Git commands; - # - Save the obtained info into files; - # - Remove `.git` afterwards. - # - deepClone = true; - postFetch = '' - cd $out - mkdir -p .nixpkgs-auxfiles/ - git rev-parse HEAD > .nixpkgs-auxfiles/git_hash - git rev-parse --abbrev-ref HEAD | tr -d '\r\n' > .nixpkgs-auxfiles/git_branch - git describe --dirty | tr -d '\r\n' > .nixpkgs-auxfiles/git_tag - git log -1 --date=iso8601-strict --format=%cd > .nixpkgs-auxfiles/git_date - find $out -name .git -print0 | xargs -0 rm -fr - ''; - hash = "sha256-ixrlr7Rm6GZAn/kh2sSeCCiK/qdmQ5+5jbbhAKjTx/E="; - }; - }; - in - self; - - shaderc-patched = shaderc.overrideAttrs ( - old: - let - version = "2024.3-unstable-2024-08-24"; - src = fetchFromGitHub { - owner = "stenzek"; - repo = "shaderc"; - rev = "f60bb80e255144e71776e2ad570d89b78ea2ab4f"; - hash = "sha256-puZxkrEVhhUT4UcCtEDmtOMX4ugkB6ooMhKRBlb++lE="; - }; - in - { - pname = "shaderc-patched-for-duckstation"; - inherit version src; - patches = (old.patches or [ ]); - cmakeFlags = (old.cmakeFlags or [ ]) ++ [ - (lib.cmakeBool "SHADERC_SKIP_EXAMPLES" true) - (lib.cmakeBool "SHADERC_SKIP_TESTS" true) - ]; - outputs = [ - "out" - "lib" - "dev" - ]; - postFixup = ''''; - } - ); - spirv-cross-patched = spirv-cross.overrideAttrs ( - old: - let - version = "1.3.290.0"; - src = fetchFromGitHub { - owner = "KhronosGroup"; - repo = "SPIRV-Cross"; - rev = "vulkan-sdk-${version}"; - hash = "sha256-h5My9PbPq1l03xpXQQFolNy7G1RhExtTH6qPg7vVF/8="; - }; - in - { - pname = "spirv-cross-patched-for-duckstation"; - inherit version src; - patches = (old.patches or [ ]); - cmakeFlags = (old.cmakeFlags or [ ]) ++ [ - (lib.cmakeBool "SPIRV_CROSS_CLI" false) - (lib.cmakeBool "SPIRV_CROSS_ENABLE_CPP" false) - (lib.cmakeBool "SPIRV_CROSS_ENABLE_C_API" true) - (lib.cmakeBool "SPIRV_CROSS_ENABLE_GLSL" true) - (lib.cmakeBool "SPIRV_CROSS_ENABLE_HLSL" false) - (lib.cmakeBool "SPIRV_CROSS_ENABLE_MSL" false) - (lib.cmakeBool "SPIRV_CROSS_ENABLE_REFLECT" false) - (lib.cmakeBool "SPIRV_CROSS_ENABLE_TESTS" false) - (lib.cmakeBool "SPIRV_CROSS_ENABLE_UTIL" true) - (lib.cmakeBool "SPIRV_CROSS_SHARED" true) - (lib.cmakeBool "SPIRV_CROSS_STATIC" false) - ]; - } - ); - discord-rpc-patched = discord-rpc.overrideAttrs (old: { - pname = "discord-rpc-patched-for-duckstation"; - version = "3.4.0-unstable-2024-08-02"; - src = fetchFromGitHub { - owner = "stenzek"; - repo = "discord-rpc"; - rev = "144f3a3f1209994d8d9e8a87964a989cb9911c1e"; - hash = "sha256-VyL8bEjY001eHWcEoUPIAFDAmaAbwcNb1hqlV2a3cWs="; - }; - patches = (old.patches or [ ]); - }); - - soundtouch-patched = stdenv.mkDerivation (finalAttrs: { - pname = "soundtouch-patched-for-duckstation"; - version = "2.2.3-unstable-2024-08-02"; - src = fetchFromGitHub { - owner = "stenzek"; - repo = "soundtouch"; - rev = "463ade388f3a51da078dc9ed062bf28e4ba29da7"; - hash = "sha256-hvBW/z+fmh/itNsJnlDBtiI1DZmUMO9TpHEztjo2pA0="; - }; - - nativeBuildInputs = [ - cmake - ninja - ]; - - meta = { - homepage = "https://github.com/stenzek/soundtouch"; - description = "SoundTouch Audio Processing Library (forked from https://codeberg.org/soundtouch/soundtouch)"; - license = lib.licenses.lgpl21; - platforms = lib.platforms.linux; - }; - - }); - - lunasvg = stdenv.mkDerivation (finalAttrs: { - pname = "lunasvg-patched-for-duckstation"; - version = "2.4.1-unstable-2024-08-24"; - src = fetchFromGitHub { - owner = "stenzek"; - repo = "lunasvg"; - rev = "9af1ac7b90658a279b372add52d6f77a4ebb482c"; - hash = "sha256-ZzOe84ZF5JRrJ9Lev2lwYOccqtEGcf76dyCDBDTvI2o="; - }; - - nativeBuildInputs = [ - cmake - ninja - ]; - - meta = { - homepage = "https://github.com/stenzek/lunasvg"; - description = "Standalone SVG rendering library in C++"; - license = lib.licenses.mit; - platforms = lib.platforms.linux; - }; - }); -} diff --git a/pkgs/by-name/du/duckstation/update.sh b/pkgs/by-name/du/duckstation/update.sh new file mode 100755 index 000000000000..2e82fa5347e4 --- /dev/null +++ b/pkgs/by-name/du/duckstation/update.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p coreutils nix curl jq +# shellcheck shell=bash + +set -euo pipefail +location="$(dirname "${BASH_SOURCE[0]}")" + +echo "checking for new tagged release (github:stenzek/duckstation)..." +old_version=$(nix --extra-experimental-features nix-command eval --raw -f . duckstation.src.tag) +new_version=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/stenzek/duckstation/tags?per_page=1" | jq -r '.[0].name') + +if [[ $old_version == "$new_version" ]]; then + echo "'duckstation' is up-to-date ($old_version == $new_version)" + exit 0 +fi + +echo "Updating duckstation from $old_version -> $new_version" +duckstation_linux_hash=$(nix --extra-experimental-features "nix-command flakes" flake prefetch github:stenzek/duckstation/"$new_version" --json | jq -r '.hash') +duckstation_darwin_hash=$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url --type sha256 "https://github.com/stenzek/duckstation/releases/download/${new_version}/duckstation-mac-release.zip")") + +echo "Vendor library update..." +duckstation_storepath=$(nix --extra-experimental-features "nix-command flakes" flake prefetch github:stenzek/duckstation/"$new_version" --json | jq -r '.storePath') +pinned_versions=$duckstation_storepath/scripts/deps/versions + +echo "Using pinned discord_rpc..." +discord_rpc_rev=$(grep "DISCORD_RPC=" "$pinned_versions" | sed 's|.*=||g') +discord_rpc_hash=$(nix --extra-experimental-features "nix-command flakes" \ + flake prefetch github:stenzek/discord-rpc/"$discord_rpc_rev" --json | + jq -r '.hash') + +echo "Using pinned shaderc..." +shaderc_rev=$(grep "SHADERC=" "$pinned_versions" | sed 's|.*=||g') +shaderc_hash=$(nix --extra-experimental-features "nix-command flakes" flake prefetch github:stenzek/shaderc/"$shaderc_rev" --json | jq -r '.hash') + +echo "Fetching latest chtdb commit..." +chtdb_json=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/duckstation/chtdb/commits?per_page=1") +chtdb_rev=$(echo "$chtdb_json" | jq -r '.[0].sha') +chtdb_date=$(echo "$chtdb_json" | jq -r '.[0].commit.author.date') +chtdb_hash=$(nix --extra-experimental-features "nix-command flakes" \ + flake prefetch github:duckstation/chtdb/"$chtdb_rev" --json | + jq -r '.hash') + +echo "Regenerating '""$location""/sources.json'" +JSON=$( + jq --null-input \ + --arg new_version "${new_version:1}" \ + --arg duckstation_linux_hash "$duckstation_linux_hash" \ + --arg duckstation_darwin_hash "$duckstation_darwin_hash" \ + --arg discord_rpc_rev "$discord_rpc_rev" \ + --arg discord_rpc_hash "$discord_rpc_hash" \ + --arg shaderc_rev "$shaderc_rev" \ + --arg shaderc_hash "$shaderc_hash" \ + --arg chtdb_rev "$chtdb_rev" \ + --arg chtdb_date "${chtdb_date::10}" \ + --arg chtdb_hash "$chtdb_hash" \ + '{ "duckstation": { + "version": $new_version, + "hash_linux": $duckstation_linux_hash, + "hash_darwin": $duckstation_darwin_hash + }, + "discord_rpc": { + "rev": $discord_rpc_rev, + "hash": $discord_rpc_hash + }, + "shaderc": { + "rev": $shaderc_rev, + "hash": $shaderc_hash + }, + "chtdb": { + "date": $chtdb_date, + "rev": $chtdb_rev, + "hash": $chtdb_hash + } + }' +) + +echo "$JSON" | jq >"$location"/sources.json diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index f41351d120e4..8880d26a6e64 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -809,6 +809,7 @@ mapAliases { dtv-scan-tables_linuxtv = dtv-scan-tables; # Added 2023-03-03 dtv-scan-tables_tvheadend = dtv-scan-tables; # Added 2023-03-03 du-dust = dust; # Added 2024-01-19 + duckstation-bin = duckstation; # Added 2025-09-20 dumb = throw "'dumb' has been archived by upstream. Upstream recommends libopenmpt as a replacement."; # Added 2025-09-14 dump1090 = dump1090-fa; # Added 2024-02-12 dwfv = throw "'dwfv' has been removed due to lack of upstream maintenance"; # Added 2025-01-25