ryujinx: init at 1.0.5160

This commit is contained in:
IvarWithoutBones 2020-07-31 13:34:41 +02:00 committed by Jon
parent 8f00cb9f9e
commit 2e2f87db13
5 changed files with 1479 additions and 0 deletions

View File

@ -0,0 +1,106 @@
{ stdenv, fetchFromGitHub, fetchurl, makeWrapper, makeDesktopItem, linkFarmFromDrvs
, dotnet-sdk_3, dotnetPackages, dotnetCorePackages
, SDL2, libX11, openal
, gtk3, gobject-introspection, wrapGAppsHook
}:
let
runtimeDeps = [
SDL2
gtk3
libX11
openal
];
in stdenv.mkDerivation rec {
pname = "ryujinx";
version = "1.0.5160";
src = fetchFromGitHub {
owner = "Ryujinx";
repo = "Ryujinx";
rev = "58f65b6523fb25d989b011c51f963520c811f9f0";
sha256 = "19fizqmcr8i3axi3j5hg8p6dxr1pxnl5l58z4pws6nj1xbq8z5mi";
};
nativeBuildInputs = [ dotnet-sdk_3 dotnetPackages.Nuget makeWrapper wrapGAppsHook gobject-introspection ];
nugetDeps = linkFarmFromDrvs "${pname}-nuget-deps" (import ./deps.nix {
fetchNuGet = { name, version, sha256 }: fetchurl {
name = "nuget-${name}-${version}.nupkg";
url = "https://www.nuget.org/api/v2/package/${name}/${version}";
inherit sha256;
};
});
patches = [ ./log.patch ]; # Without this, Ryujinx tries to write logs to the nix store. This patch makes it write to "~/.config/Ryujinx/Logs" on Linux.
configurePhase = ''
runHook preConfigure
export HOME=$(mktemp -d)
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
nuget sources Add -Name nixos -Source "$PWD/nixos"
nuget init "$nugetDeps" "$PWD/nixos"
# FIXME: https://github.com/NuGet/Home/issues/4413
mkdir -p $HOME/.nuget/NuGet
cp $HOME/.config/NuGet/NuGet.Config $HOME/.nuget/NuGet
dotnet restore --source nixos Ryujinx.sln
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
dotnet build Ryujinx.sln \
--no-restore \
--configuration Release \
-p:Version=${version}
runHook postBuild
'';
installPhase = ''
runHook preInstall
dotnet publish Ryujinx.sln \
--no-build \
--configuration Release \
--no-self-contained \
--output $out/lib/ryujinx
shopt -s extglob
makeWrapper $out/lib/ryujinx/Ryujinx $out/bin/Ryujinx \
--set DOTNET_ROOT "${dotnetCorePackages.netcore_3_1}" \
--suffix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath runtimeDeps}" \
''${gappsWrapperArgs[@]}
for i in 16 32 48 64 96 128 256 512 1024; do
install -D ${src}/Ryujinx/Ui/assets/Icon.png $out/share/icons/hicolor/''${i}x$i/apps/ryujinx.png
done
cp -r ${makeDesktopItem {
desktopName = "Ryujinx";
name = "ryujinx";
exec = "Ryujinx";
icon = "ryujinx";
comment = meta.description;
type = "Application";
categories = "Game;";
}}/share/applications $out/share
runHook postInstall
'';
# Strip breaks the executable.
dontStrip = true;
meta = with stdenv.lib; {
description = "Experimental Nintendo Switch Emulator written in C#";
homepage = "https://ryujinx.org/";
license = licenses.mit;
maintainers = [ maintainers.ivar ];
platforms = [ "x86_64-linux" ];
};
}

1317
pkgs/misc/emulators/ryujinx/deps.nix generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts dotnet-sdk_3
set -eo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
deps_file="$(realpath "./deps.nix")"
# Setup empty nuget package folder to force reinstall.
mkdir ./nuget_tmp.packages
cat >./nuget_tmp.config <<EOF
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<config>
<add key="globalPackagesFolder" value="$(realpath ./nuget_tmp.packages)" />
</config>
</configuration>
EOF
dotnet restore Ryujinx.sln --configfile ./nuget_tmp.config
echo "{ fetchNuGet }: [" >"$deps_file"
while read pkg_spec; do
{ read pkg_name; read pkg_version; } < <(
# Build version part should be ignored: `3.0.0-beta2.20059.3+77df2220` -> `3.0.0-beta2.20059.3`
sed -nE 's/.*<id>([^<]*).*/\1/p; s/.*<version>([^<+]*).*/\1/p' "$pkg_spec")
pkg_sha256="$(nix-hash --type sha256 --flat --base32 "$(dirname "$pkg_spec")"/*.nupkg)"
cat >>"$deps_file" <<EOF
(fetchNuGet {
name = "$pkg_name";
version = "$pkg_version";
sha256 = "$pkg_sha256";
})
EOF
done < <(find ./nuget_tmp.packages -name '*.nuspec' | sort)
echo "]" >>"$deps_file"
popd
rm -r "$src"

View File

@ -0,0 +1,13 @@
diff --git a/Ryujinx.Common/Configuration/LoggerModule.cs b/Ryujinx.Common/Configuration/LoggerModule.cs
index 20c0fb46..ce933730 100644
--- a/Ryujinx.Common/Configuration/LoggerModule.cs
+++ b/Ryujinx.Common/Configuration/LoggerModule.cs
@@ -75,7 +75,7 @@ namespace Ryujinx.Configuration
if (e.NewValue)
{
Logger.AddTarget(new AsyncLogTargetWrapper(
- new FileLogTarget(AppDomain.CurrentDomain.BaseDirectory, "file"),
+ new FileLogTarget(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ryujinx"), "file"),
1000,
AsyncLogTargetOverflowAction.Block
));

View File

@ -2268,6 +2268,8 @@ in
remarkable-mouse = python3Packages.callPackage ../applications/misc/remarkable/remarkable-mouse { };
ryujinx = callPackage ../misc/emulators/ryujinx { };
scour = with python3Packages; toPythonApplication scour;
s2png = callPackage ../tools/graphics/s2png { };