2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchurl, makeWrapper, makeDesktopItem, linkFarmFromDrvs
|
2021-02-03 23:23:49 +01:00
|
|
|
, dotnet-sdk_5, dotnetPackages, dotnetCorePackages, cacert
|
2021-03-30 01:56:02 +02:00
|
|
|
, SDL2, libX11, libgdiplus, ffmpeg, openal, libsoundio
|
2021-01-25 20:23:05 +01:00
|
|
|
, gtk3, gobject-introspection, gdk-pixbuf, wrapGAppsHook
|
2020-07-31 13:34:41 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
runtimeDeps = [
|
|
|
|
SDL2
|
|
|
|
gtk3
|
|
|
|
libX11
|
2021-03-30 01:56:02 +02:00
|
|
|
libgdiplus
|
2021-01-28 21:40:11 +01:00
|
|
|
ffmpeg
|
2020-07-31 13:34:41 +02:00
|
|
|
openal
|
2021-01-28 21:40:11 +01:00
|
|
|
libsoundio
|
2020-07-31 13:34:41 +02:00
|
|
|
];
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "ryujinx";
|
2021-04-14 21:43:24 +02:00
|
|
|
version = "1.0.6835"; # Versioning is based off of the official appveyor builds: https://ci.appveyor.com/project/gdkchan/ryujinx
|
2020-07-31 13:34:41 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Ryujinx";
|
|
|
|
repo = "Ryujinx";
|
2021-04-14 21:43:24 +02:00
|
|
|
rev = "e520eecb5ba682d4b51bb782e3bc99fb1d6afe04";
|
|
|
|
sha256 = "1yy1xslnvvl0m7g0jszj2pjwdwf0pbv53crzfkhla3n68kvfy00f";
|
2020-07-31 13:34:41 +02:00
|
|
|
};
|
|
|
|
|
2021-02-03 23:23:49 +01:00
|
|
|
nativeBuildInputs = [ dotnet-sdk_5 dotnetPackages.Nuget cacert makeWrapper wrapGAppsHook gobject-introspection gdk-pixbuf ];
|
2020-07-31 13:34:41 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2021-01-28 21:40:11 +01:00
|
|
|
patches = [
|
|
|
|
./log.patch # Without this, Ryujinx attempts to write logs to the nix store. This patch makes it write to "~/.config/Ryujinx/Logs" on Linux.
|
|
|
|
];
|
2020-07-31 13:34:41 +02:00
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
2021-02-15 22:40:17 +01:00
|
|
|
export DOTNET_NOLOGO=1
|
2020-07-31 13:34:41 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-09-19 01:25:03 +02:00
|
|
|
dotnet restore --source "$PWD/nixos" Ryujinx.sln
|
2020-07-31 13:34:41 +02:00
|
|
|
|
|
|
|
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 \
|
2021-01-25 20:23:05 +01:00
|
|
|
--set DOTNET_ROOT "${dotnetCorePackages.net_5_0}" \
|
2021-01-15 14:21:58 +01:00
|
|
|
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \
|
2020-07-31 13:34:41 +02:00
|
|
|
''${gappsWrapperArgs[@]}
|
|
|
|
|
|
|
|
for i in 16 32 48 64 96 128 256 512 1024; do
|
2021-01-25 20:23:05 +01:00
|
|
|
install -D ${src}/Ryujinx/Ui/Resources/Logo_Ryujinx.png $out/share/icons/hicolor/''${i}x$i/apps/ryujinx.png
|
2020-07-31 13:34:41 +02:00
|
|
|
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;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-07-31 13:34:41 +02:00
|
|
|
description = "Experimental Nintendo Switch Emulator written in C#";
|
|
|
|
homepage = "https://ryujinx.org/";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.ivar ];
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
2021-03-30 01:56:02 +02:00
|
|
|
passthru.updateScript = ./updater.sh;
|
2020-07-31 13:34:41 +02:00
|
|
|
}
|