Merge pull request #277526 from K900/clean-fruit

yuzu: reorganize everything, use common updater scripts, actually update
This commit is contained in:
K900 2023-12-31 13:45:55 +03:00 committed by GitHub
commit c5a7b36c8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 181 additions and 185 deletions

View File

@ -0,0 +1,18 @@
{ stdenv, fetchFromGitHub, unstableGitUpdater }:
stdenv.mkDerivation {
pname = "yuzu-compatibility-list";
version = "unstable-2023-12-28";
src = fetchFromGitHub {
owner = "flathub";
repo = "org.yuzu_emu.yuzu";
rev = "0b9bf10851d6ad54441dc4f687d5755ed2c6f7a8";
hash = "sha256-oWEeAhyxFO1TFH3d+/ivRf1KnNUU8y5c/7NtOzlpKXg=";
};
buildCommand = ''
cp $src/compatibility_list.json $out
'';
passthru.updateScript = unstableGitUpdater {};
}

View File

@ -1,68 +1,22 @@
{ branch ? "mainline"
, qt6Packages
, fetchFromGitHub
, fetchgit
, fetchurl
, fetchzip
, runCommand
, gnutar
}:
{ qt6Packages, makeScopeWithSplicing', generateSplicesForMkScope, vulkan-headers, fetchFromGitHub }:
let
sources = import ./sources.nix;
makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "yuzuPackages";
f = self: qt6Packages // {
compat-list = self.callPackage ./compat-list.nix {};
nx_tzdb = self.callPackage ./nx_tzdb.nix {};
compat-list = fetchurl {
name = "yuzu-compat-list";
url = "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${sources.compatList.rev}/compatibility_list.json";
hash = sources.compatList.hash;
mainline = self.callPackage ./mainline.nix {};
early-access = self.callPackage ./early-access {};
vulkan-headers = vulkan-headers.overrideAttrs(old: rec {
version = "1.3.274";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-Headers";
rev = "v${version}";
hash = "sha256-SsS5VlEnhjOSu8MlIVC0d2r2EAf8QsNJPEAXNtbDOJ4=";
};
});
};
mainlineSrc = fetchFromGitHub {
owner = "yuzu-emu";
repo = "yuzu-mainline";
rev = "mainline-0-${sources.mainline.version}";
hash = sources.mainline.hash;
fetchSubmodules = true;
};
# The mirror repo for early access builds is missing submodule info,
# but the Windows distributions include a source tarball, which in turn
# includes the full git metadata. So, grab that and rehydrate it.
# This has the unfortunate side effect of requiring two FODs, one
# for the Windows download and one for the full repo with submodules.
eaZip = fetchzip {
name = "yuzu-ea-windows-dist";
url = "https://github.com/pineappleEA/pineapple-src/releases/download/EA-${sources.ea.version}/Windows-Yuzu-EA-${sources.ea.version}.zip";
hash = sources.ea.distHash;
};
eaGitSrc = runCommand "yuzu-ea-dist-unpacked" {
src = eaZip;
nativeBuildInputs = [ gnutar ];
}
''
mkdir $out
tar xf $src/*.tar.xz --directory=$out --strip-components=1
'';
eaSrcRehydrated = fetchgit {
url = eaGitSrc;
fetchSubmodules = true;
hash = sources.ea.fullHash;
};
in {
mainline = qt6Packages.callPackage ./generic.nix {
branch = "mainline";
version = sources.mainline.version;
src = mainlineSrc;
inherit compat-list;
};
early-access = qt6Packages.callPackage ./generic.nix {
branch = "early-access";
version = sources.ea.version;
src = eaSrcRehydrated;
inherit compat-list;
};
}.${branch}
}

View File

@ -0,0 +1,36 @@
{ mainline, fetchzip, fetchgit, runCommand, gnutar }:
# The mirror repo for early access builds is missing submodule info,
# but the Windows distributions include a source tarball, which in turn
# includes the full git metadata. So, grab that and rehydrate it.
# This has the unfortunate side effect of requiring two FODs, one
# for the Windows download and one for the full repo with submodules.
let
sources = import ./sources.nix;
zip = fetchzip {
name = "yuzu-ea-windows-dist";
url = "https://github.com/pineappleEA/pineapple-src/releases/download/EA-${sources.version}/Windows-Yuzu-EA-${sources.version}.zip";
hash = sources.distHash;
};
gitSrc = runCommand "yuzu-ea-dist-unpacked" {
src = zip;
nativeBuildInputs = [ gnutar ];
}
''
mkdir $out
tar xf $src/*.tar.xz --directory=$out --strip-components=1
'';
rehydratedSrc = fetchgit {
url = gitSrc;
fetchSubmodules = true;
hash = sources.fullHash;
};
in mainline.overrideAttrs(old: {
pname = "yuzu-early-access";
version = sources.version;
src = rehydratedSrc;
passthru.updateScript = ./update.sh;
meta = old.meta // { description = old.meta.description + " - early access branch"; };
})

View File

@ -0,0 +1,7 @@
# Generated by ./update.sh - do not update manually!
# Last updated: 2023-12-29
{
version = "4037";
distHash = "sha256:0pw56hj13fm9j5nja1lhj839d88w00kcr30kygasr36w9c7yv2n7";
fullHash = "sha256:0f42fp8z333b3k4pn8j0cp3480llvlygl5p6qfgywhq3g5hcpzpb";
}

View File

@ -0,0 +1,48 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix nix-prefetch-git gnutar curl jq unzip
set -euo pipefail
cd "$(dirname "$(readlink -f "$0")")"
log() {
tput bold
echo "#" "$@"
tput sgr0
}
oldVersion="$(nix --experimental-features nix-command eval -f sources.nix --raw version)"
newVersion="$(curl "https://api.github.com/repos/pineappleEA/pineapple-src/releases?per_page=1" | jq -r '.[0].tag_name' | cut -d"-" -f2)"
if [ "$oldVersion" == "$newVersion" ]; then
log "Already up to date"
exit 0
fi
fetched="$(nix-prefetch-url --unpack --print-path "https://github.com/pineappleEA/pineapple-src/releases/download/EA-${newVersion}/Windows-Yuzu-EA-${newVersion}.zip")"
eaDistHash="$(echo "${fetched}" | head -n1)"
eaDist="$(echo "${fetched}" | tail -n1)"
eaDistUnpacked="$(mktemp -d)"
trap 'rm -rf "$eaDistUnpacked"' EXIT
log "Unpacking dist..."
tar xf "$eaDist"/*.tar.xz --directory="$eaDistUnpacked" --strip-components=1
log "Rehydrating..."
eaFullHash="$(nix-prefetch-git --fetch-submodules "$eaDistUnpacked" | jq -r '.sha256')"
cat >sources.nix <<EOF
# Generated by ./update.sh - do not update manually!
# Last updated: $(date +%F)
{
version = "$newVersion";
distHash = "sha256:$eaDistHash";
fullHash = "sha256:$eaFullHash";
}
EOF
if [ "${COMMIT:-0}" == "1" ]; then
git commit -m "yuzu-ea: ${oldVersion} -> ${newVersion}" ./sources.nix
fi

View File

@ -1,21 +1,18 @@
{ version
, src
, branch
, compat-list
, lib
{ lib
, stdenv
, fetchFromGitHub
, nix-update-script
, wrapQtAppsHook
, alsa-lib
, boost
, catch2_3
, cmake
, compat-list
, cpp-jwt
, cubeb
, discord-rpc
, doxygen
, enet
, fetchurl
, ffmpeg
, fmt
, glslang
@ -29,6 +26,7 @@
, libzip
, lz4
, nlohmann_json
, nx_tzdb
, perl
, pkg-config
, python3
@ -47,17 +45,17 @@
, zlib
, zstd
}:
stdenv.mkDerivation(finalAttrs: {
pname = "yuzu";
version = "1665";
let
tzinfoVersion = "221202";
tzinfo = fetchurl {
url = "https://github.com/lat9nq/tzdb_to_nx/releases/download/${tzinfoVersion}/${tzinfoVersion}.zip";
hash = "sha256-mRzW+iIwrU1zsxHmf+0RArU8BShAoEMvCz+McXFFK3c=";
src = fetchFromGitHub {
owner = "yuzu-emu";
repo = "yuzu-mainline";
rev = "mainline-0-${finalAttrs.version}";
hash = "sha256-xzSup1oz83GPpOGh9aJJ5YjoFX/cBI8RV6SvDYNH/zA=";
fetchSubmodules = true;
};
in stdenv.mkDerivation {
pname = "yuzu-${branch}";
inherit version src;
nativeBuildInputs = [
cmake
@ -69,6 +67,10 @@ in stdenv.mkDerivation {
];
buildInputs = [
# vulkan-headers must come first, so the older propagated versions
# don't get picked up by accident
vulkan-headers
alsa-lib
boost
catch2_3
@ -101,7 +103,6 @@ in stdenv.mkDerivation {
sndio
speexdsp
udev
vulkan-headers
# intentionally omitted: xbyak - prefer vendored version for compatibility
zlib
zstd
@ -120,6 +121,8 @@ in stdenv.mkDerivation {
"-DENABLE_QT_TRANSLATION=ON"
# use system libraries
# NB: "external" here means "from the externals/ directory in the source",
# so "off" means "use system"
"-DYUZU_USE_EXTERNAL_SDL2=OFF"
"-DYUZU_USE_EXTERNAL_VULKAN_HEADERS=OFF"
@ -145,13 +148,13 @@ in stdenv.mkDerivation {
preConfigure = ''
# see https://github.com/NixOS/nixpkgs/issues/114044, setting this through cmakeFlags does not work.
cmakeFlagsArray+=(
"-DTITLE_BAR_FORMAT_IDLE=yuzu | ${branch} ${version} (nixpkgs) {}"
"-DTITLE_BAR_FORMAT_RUNNING=yuzu | ${branch} ${version} (nixpkgs) | {}"
"-DTITLE_BAR_FORMAT_IDLE=${finalAttrs.pname} | ${finalAttrs.version} (nixpkgs) {}"
"-DTITLE_BAR_FORMAT_RUNNING=${finalAttrs.pname} | ${finalAttrs.version} (nixpkgs) | {}"
)
# provide pre-downloaded tz data
mkdir -p build/externals/nx_tzdb
ln -sf ${tzinfo} build/externals/nx_tzdb/${tzinfoVersion}.zip
ln -sf ${nx_tzdb} build/externals/nx_tzdb/${nx_tzdb.version}.zip
'';
# This must be done after cmake finishes as it overwrites the file
@ -159,12 +162,14 @@ in stdenv.mkDerivation {
ln -sf ${compat-list} ./dist/compatibility_list/compatibility_list.json
'';
passthru.updateScript = ./update.sh;
passthru.updateScript = nix-update-script {
extraArgs = [ "--version-regex" "mainline-0-(.*)" ];
};
meta = with lib; {
homepage = "https://yuzu-emu.org";
changelog = "https://yuzu-emu.org/entry";
description = "The ${branch} branch of an experimental Nintendo Switch emulator written in C++";
description = "An experimental Nintendo Switch emulator written in C++";
longDescription = ''
An experimental Nintendo Switch emulator written in C++.
Using the mainline branch is recommended for general usage.
@ -185,4 +190,4 @@ in stdenv.mkDerivation {
k900
];
};
}
})

View File

@ -0,0 +1,20 @@
{ stdenv, fetchurl, gitUpdater }:
stdenv.mkDerivation rec {
pname = "nx_tzdb";
version = "221202";
src = fetchurl {
url = "https://github.com/lat9nq/tzdb_to_nx/releases/download/${version}/${version}.zip";
hash = "sha256-mRzW+iIwrU1zsxHmf+0RArU8BShAoEMvCz+McXFFK3c=";
};
dontUnpack = true;
buildCommand = ''
cp $src $out
'';
passthru.updateScript = gitUpdater {
url = "https://github.com/lat9nq/tzdb_to_nx.git";
};
}

View File

@ -1,19 +0,0 @@
# Generated by ./update.sh - do not update manually!
# Last updated: 2023-12-14
{
compatList = {
rev = "fc974b6e78105774dae5f68e712a6beb51b9db1e";
hash = "sha256:1hdsza3wf9a0yvj6h55gsl7xqvhafvbz1i8paz9kg7l49b0gnlh1";
};
mainline = {
version = "1651";
hash = "sha256:00cxyh3d18k17g982yqcbaq4b6bgs4kji0yz6i15h066aj15dimy";
};
ea = {
version = "4019";
distHash = "sha256:1qd953bl216yxmaa6y0iil6pn2pn53k87qwagbmcd4l5h4aaqi7h";
fullHash = "sha256:0na96hqfdd40q6drrlgak4qdsxs3wfizxhb8kf8qrbai3qfpx00v";
};
}

View File

@ -1,66 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix nix-prefetch-git gnutar curl jq unzip
set -euo pipefail
cd "$(dirname "$(readlink -f "$0")")"
log() {
tput bold
echo "#" "$@"
tput sgr0
}
alias curl='curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"}'
log "Updating compatibility list..."
compatListRev="$(curl "https://api.github.com/repos/flathub/org.yuzu_emu.yuzu/commits/master" | jq -r '.sha')"
log "Downloading rev: ${compatListRev}"
compatListHash="$(nix-prefetch-url "https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/${compatListRev}/compatibility_list.json")"
log "Updating mainline..."
mainlineVersion="$(curl "https://api.github.com/repos/yuzu-emu/yuzu-mainline/releases?per_page=1" | jq -r '.[0].name' | cut -d" " -f2)"
log "Downloading version: ${mainlineVersion}"
mainlineHash="$(nix-prefetch-git --fetch-submodules --rev "mainline-0-${mainlineVersion}" "https://github.com/yuzu-emu/yuzu-mainline" | jq -r '.sha256')"
log "Updating early access..."
eaVersion="$(curl "https://api.github.com/repos/pineappleEA/pineapple-src/releases?per_page=1" | jq -r '.[0].tag_name' | cut -d"-" -f2)"
log "Downloading dist version: ${eaVersion}"
fetched="$(nix-prefetch-url --unpack --print-path "https://github.com/pineappleEA/pineapple-src/releases/download/EA-${eaVersion}/Windows-Yuzu-EA-${eaVersion}.zip")"
eaDistHash="$(echo "${fetched}" | head -n1)"
eaDist="$(echo "${fetched}" | tail -n1)"
eaDistUnpacked="$(mktemp -d)"
trap 'rm -rf "$eaDistUnpacked"' EXIT
log "Unpacking dist..."
tar xf "$eaDist"/*.tar.xz --directory="$eaDistUnpacked" --strip-components=1
log "Rehydrating..."
eaFullHash="$(nix-prefetch-git --fetch-submodules "$eaDistUnpacked" | jq -r '.sha256')"
cat >sources.nix <<EOF
# Generated by ./update.sh - do not update manually!
# Last updated: $(date +%F)
{
compatList = {
rev = "$compatListRev";
hash = "sha256:$compatListHash";
};
mainline = {
version = "$mainlineVersion";
hash = "sha256:$mainlineHash";
};
ea = {
version = "$eaVersion";
distHash = "sha256:$eaDistHash";
fullHash = "sha256:$eaFullHash";
};
}
EOF

View File

@ -1054,8 +1054,10 @@ mapAliases ({
yacc = bison; # moved from top-level 2021-03-14
yafaray-core = libyafaray; # Added 2022-09-23
yarn2nix-moretea-openssl_1_1 = throw "'yarn2nix-moretea-openssl_1_1' has been removed."; # Added 2023-02-04
yuzu-ea = yuzu-early-access; # Added 2022-08-18
yuzu = yuzu-mainline; # Added 2021-01-25
yuzu-ea = yuzuPackages.early-access; # Added 2022-08-18
yuzu-early-access = yuzuPackages.early-access; # Added 2023-12-29
yuzu = yuzuPackages.mainline; # Added 2021-01-25
yuzu-mainline = yuzuPackages.mainline; # Added 2023-12-29
### Z ###

View File

@ -2947,16 +2947,7 @@ with pkgs;
callPackage ../applications/emulators/retroarch/kodi-advanced-launchers.nix { };
### APPLICATIONS/EMULATORS/YUZU
yuzu-mainline = import ../applications/emulators/yuzu {
inherit qt6Packages fetchFromGitHub fetchgit fetchurl fetchzip runCommand gnutar;
branch = "mainline";
};
yuzu-early-access = import ../applications/emulators/yuzu {
inherit qt6Packages fetchFromGitHub fetchgit fetchurl fetchzip runCommand gnutar;
branch = "early-access";
};
yuzuPackages = callPackage ../applications/emulators/yuzu {};
### APPLICATIONS/EMULATORS/COMMANDERX16