nixpkgs/pkgs/applications/emulators/cemu/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

146 lines
3.1 KiB
Nix
Raw Normal View History

2022-10-31 20:01:48 +00:00
{ lib, stdenv, fetchFromGitHub
, fetchpatch
2022-10-31 20:01:48 +00:00
, addOpenGLRunpath
, wrapGAppsHook
, cmake
, glslang
, nasm
, pkg-config
, SDL2
, boost
, cubeb
, curl
, fmt_9
, glm
, gtk3
2023-08-27 06:28:35 +00:00
, hidapi
2022-10-31 20:01:48 +00:00
, imgui
, libpng
2023-11-05 22:34:28 +00:00
, libusb1
2022-10-31 20:01:48 +00:00
, libzip
, libXrender
, pugixml
, rapidjson
, vulkan-headers
2022-12-16 08:29:33 +00:00
, wayland
2022-10-31 20:01:48 +00:00
, wxGTK32
, zarchive
2023-05-14 04:48:53 +00:00
, gamemode
2022-10-31 20:01:48 +00:00
, vulkan-loader
, nix-update-script
2022-10-31 20:01:48 +00:00
}:
stdenv.mkDerivation rec {
pname = "cemu";
2024-01-20 15:40:55 +00:00
version = "2.0-65";
2022-10-31 20:01:48 +00:00
src = fetchFromGitHub {
owner = "cemu-project";
repo = "Cemu";
rev = "v${version}";
2024-01-20 15:40:55 +00:00
hash = "sha256-jsDmxol3zZMmpo4whDeUXTzfO+QVK/h6lItXTyJyoak=";
2022-10-31 20:01:48 +00:00
};
patches = [
# glslangTargets want SPIRV-Tools-opt to be defined:
# > The following imported targets are referenced, but are missing:
# > SPIRV-Tools-opt
./cmakelists.patch
# Remove on next release
# https://github.com/cemu-project/Cemu/pull/1076
(fetchpatch {
url = "https://github.com/cemu-project/Cemu/commit/72aacbdcecc064ea7c3b158c433e4803496ac296.patch";
hash = "sha256-x+ZVqXgGRSv0VYwJAX35C1p7PnmCHS7iEO+4k8j0/ug=";
})
2022-10-31 20:01:48 +00:00
];
nativeBuildInputs = [
addOpenGLRunpath
wrapGAppsHook
cmake
glslang
nasm
pkg-config
];
buildInputs = [
SDL2
boost
cubeb
curl
fmt_9
glm
gtk3
2023-08-27 06:28:35 +00:00
hidapi
2022-10-31 20:01:48 +00:00
imgui
libpng
2023-11-05 22:34:28 +00:00
libusb1
2022-10-31 20:01:48 +00:00
libzip
libXrender
pugixml
rapidjson
vulkan-headers
2022-12-16 08:29:33 +00:00
wayland
2022-10-31 20:01:48 +00:00
wxGTK32
zarchive
];
cmakeFlags = [
"-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG"
"-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG"
"-DENABLE_VCPKG=OFF"
2023-05-14 04:48:53 +00:00
"-DENABLE_FERAL_GAMEMODE=ON"
2022-10-31 20:01:48 +00:00
# PORTABLE:
# "All data created and maintained by Cemu will be in the directory where the executable file is located"
"-DPORTABLE=OFF"
];
2023-04-16 03:46:02 +00:00
preConfigure = with lib; let
tag = last (splitString "-" version);
in ''
2022-10-31 20:01:48 +00:00
rm -rf dependencies/imgui
ln -s ${imgui}/include/imgui dependencies/imgui
2023-05-14 04:48:53 +00:00
substituteInPlace src/Common/version.h --replace " (experimental)" "-${tag} (experimental)"
substituteInPlace dependencies/gamemode/lib/gamemode_client.h --replace "libgamemode.so.0" "${gamemode.lib}/lib/libgamemode.so.0"
2022-10-31 20:01:48 +00:00
'';
installPhase = ''
runHook preInstall
install -Dm755 ../bin/Cemu_release $out/bin/Cemu
ln -s $out/bin/Cemu $out/bin/cemu
mkdir -p $out/share/applications
substitute ../dist/linux/info.cemu.Cemu.desktop $out/share/applications/info.cemu.Cemu.desktop \
--replace "Exec=Cemu" "Exec=$out/bin/Cemu"
install -Dm644 ../dist/linux/info.cemu.Cemu.metainfo.xml -t $out/share/metainfo
install -Dm644 ../src/resource/logo_icon.png $out/share/icons/hicolor/128x128/apps/info.cemu.Cemu.png
runHook postInstall
'';
preFixup = let
libs = [ vulkan-loader ] ++ cubeb.passthru.backendLibs;
in ''
2022-11-22 13:30:09 +00:00
gappsWrapperArgs+=(
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath libs}"
)
2022-10-31 20:01:48 +00:00
'';
passthru.updateScript = nix-update-script { };
2022-10-31 20:01:48 +00:00
meta = with lib; {
description = "Cemu is a Wii U emulator";
homepage = "https://cemu.info";
license = licenses.mpl20;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ zhaofengli baduhai ];
mainProgram = "cemu";
2022-10-31 20:01:48 +00:00
};
}