Compare commits

...

3 Commits

Author SHA1 Message Date
da7ad62b16 add citra archive 2024-03-05 23:42:38 -08:00
641c2ba3b5 add my own arcive of yuzu 2024-03-05 22:41:45 -08:00
4f08f987a6 update ignore for private 2024-03-05 17:21:21 -08:00
6 changed files with 374 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.gen .gen
temp_bin temp_bin
home/dot_config/hypr/monitors.conf home/dot_config/hypr/monitors.conf
private/

View File

@ -18,7 +18,8 @@ in {
steam steam
steamtinkerlaunch steamtinkerlaunch
gamescope gamescope
yuzu-early-access yuzu-archive
citra-archive
dolphin-emu dolphin-emu
ppsspp ppsspp
mgba mgba

View File

@ -6,4 +6,7 @@ final: prev: {
advcpmv = final.callPackage ../pkgs/advcpmv.nix {}; advcpmv = final.callPackage ../pkgs/advcpmv.nix {};
taskopen = final.callPackage ../pkgs/taskopen.nix {}; taskopen = final.callPackage ../pkgs/taskopen.nix {};
cookcli = final.callPackage ../pkgs/cookcli.nix {}; cookcli = final.callPackage ../pkgs/cookcli.nix {};
nx_tzdb = final.callPackage ../pkgs/nx_tzdb.nix {};
yuzu-archive = final.libsForQt5.callPackage ../pkgs/yuzu-archive.nix {};
citra-archive = final.qt6Packages.callPackage ../pkgs/citra-archive.nix {};
} }

View File

@ -0,0 +1,156 @@
{ lib
, stdenv
, cmake
, boost
, pkg-config
, catch2_3
, cpp-jwt
, cryptopp
, enet
, ffmpeg
, fmt
, gamemode
, glslang
, httplib
, inih
, libusb1
, nlohmann_json
, openal
, openssl
, SDL2
, soundtouch
, spirv-tools
, zstd
, vulkan-headers
, vulkan-loader
, enableSdl2Frontend ? true
, enableQt ? true, qtbase, qtmultimedia, qtwayland, wrapQtAppsHook
, enableQtTranslation ? enableQt, qttools
, enableWebService ? true
, enableCubeb ? true, cubeb
, useDiscordRichPresence ? false, rapidjson
, fetchFromGitea
}:
let
branch = "archive";
version = "2088";
in
stdenv.mkDerivation {
pname = "citra-archive";
version = "2088";
src = fetchFromGitea {
domain = "git.tstarr.us";
owner = "tstarr";
repo = "citra";
rev = "813d0c2a302cd5b7cb23ed0307d8984df3df4a21";
hash = "sha256-k07BdZr8Y4S8cUDJVnCw4NkeeRJoXfuK0aRx6EJ3bAQ=";
fetchSubmodules = true;
};
nativeBuildInputs = [
cmake
pkg-config
ffmpeg
glslang
] ++ lib.optionals enableQt [ wrapQtAppsHook ];
buildInputs = [
boost
catch2_3
cpp-jwt
cryptopp
# intentionally omitted: dynarmic - prefer vendored version for compatibility
enet
fmt
httplib
inih
libusb1
nlohmann_json
openal
openssl
SDL2
soundtouch
spirv-tools
vulkan-headers
# intentionally omitted: xbyak - prefer vendored version for compatibility
zstd
] ++ lib.optionals enableQt [ qtbase qtmultimedia qtwayland ]
++ lib.optional enableQtTranslation qttools
++ lib.optional enableCubeb cubeb
++ lib.optional useDiscordRichPresence rapidjson;
cmakeFlags = [
(lib.cmakeBool "USE_SYSTEM_LIBS" true)
(lib.cmakeBool "DISABLE_SYSTEM_DYNARMIC" true)
(lib.cmakeBool "DISABLE_SYSTEM_GLSLANG" true) # The following imported targets are referenced, but are missing: SPIRV-Tools-opt
(lib.cmakeBool "DISABLE_SYSTEM_LODEPNG" true) # Not packaged in nixpkgs
(lib.cmakeBool "DISABLE_SYSTEM_VMA" true)
(lib.cmakeBool "DISABLE_SYSTEM_XBYAK" true)
# We don't want to bother upstream with potentially outdated compat reports
(lib.cmakeBool "CITRA_ENABLE_COMPATIBILITY_REPORTING" true)
(lib.cmakeBool "ENABLE_COMPATIBILITY_LIST_DOWNLOAD" false) # We provide this deterministically
(lib.cmakeBool "ENABLE_SDL2_FRONTEND" enableSdl2Frontend)
(lib.cmakeBool "ENABLE_QT" enableQt)
(lib.cmakeBool "ENABLE_QT_TRANSLATION" enableQtTranslation)
(lib.cmakeBool "ENABLE_WEB_SERVICE" enableWebService)
(lib.cmakeBool "ENABLE_CUBEB" enableCubeb)
(lib.cmakeBool "USE_DISCORD_PRESENCE" useDiscordRichPresence)
];
# causes redefinition of _FORTIFY_SOURCE
hardeningDisable = [ "fortify3" ];
postPatch = let
branchCaptialized = (lib.toUpper (lib.substring 0 1 branch) + lib.substring 1 (-1) branch);
in ''
# Fix file not found when looking in var/empty instead of opt
mkdir -p externals/dynarmic/src/dynarmic/ir/var
ln -s ../opt externals/dynarmic/src/dynarmic/ir/var/empty
# We already know the submodules are present
substituteInPlace CMakeLists.txt \
--replace "check_submodules_present()" ""
# Add versions
echo 'set(BUILD_FULLNAME "${branchCaptialized} ${version}")' >> CMakeModules/GenerateBuildInfo.cmake
# Add gamemode
substituteInPlace externals/gamemode/include/gamemode_client.h --replace "libgamemode.so.0" "${lib.getLib gamemode}/lib/libgamemode.so.0"
'';
postInstall = let
libs = lib.makeLibraryPath [ vulkan-loader ];
in lib.optionalString enableSdl2Frontend ''
wrapProgram "$out/bin/citra" \
--prefix LD_LIBRARY_PATH : ${libs}
'' + lib.optionalString enableQt ''
qtWrapperArgs+=(
--prefix LD_LIBRARY_PATH : ${libs}
)
'';
meta = with lib; {
broken = (stdenv.isLinux && stdenv.isAarch64);
homepage = "https://citra-emu.org";
description = "The ${branch} branch of an open-source emulator for the Nintendo 3DS";
longDescription = ''
A Nintendo 3DS Emulator written in C++
Using the nightly branch is recommended for general usage.
Using the canary branch is recommended if you would like to try out
experimental features, with a cost of stability.
'';
mainProgram = if enableQt then "citra-qt" else "citra";
platforms = platforms.linux;
license = licenses.gpl2Plus;
maintainers = with maintainers; [
abbradar
ashley
ivar
];
};
}

View File

@ -0,0 +1,20 @@
{ stdenv, fetchurl, unzip, gitUpdater }:
stdenv.mkDerivation rec {
pname = "nx_tzdb";
version = "221202";
src = fetchurl {
url = "https://git.tstarr.us/tstarr/tzdb_to_nx/releases/download/221202/221202.zip";
hash = "sha256-mRzW+iIwrU1zsxHmf+0RArU8BShAoEMvCz+McXFFK3c=";
};
nativeBuildInputs = [ unzip ];
buildCommand = ''
unzip $src -d $out
'';
passthru.updateScript = gitUpdater {
url = "https://git.tstarr.us/tstarr/tzdb_to_nx";
};
}

View File

@ -0,0 +1,192 @@
{ lib
, stdenv
, fetchFromGitea
, nix-update-script
, wrapQtAppsHook
, autoconf
, boost
, catch2_3
, cmake
, cpp-jwt
, cubeb
, discord-rpc
, enet
, fmt
, glslang
, libopus
, libusb1
, libva
, lz4
, nlohmann_json
, nv-codec-headers-12
, pkg-config
, qtbase
, qtmultimedia
, qttools
, qtwayland
, qtwebengine
, SDL2
, vulkan-headers
, vulkan-loader
, yasm
, zlib
, zstd
, fetchzip
, fetchgit
, runCommand
, gnutar
, nx_tzdb
}:
stdenv.mkDerivation(finalAttrs: {
pname = "yuzu-archive";
version = "4176";
src = fetchFromGitea {
domain = "git.tstarr.us";
owner = "tstarr";
repo = "yuzu-mainline";
rev = "d3a974b64679229e77a3af921994dab82d092249";
hash = "sha256-sn/CfaZkS3noDH9lmEtIES6Xc7aoZ5tbHo1AJc5nxac=";
fetchSubmodules = true;
};
nativeBuildInputs = [
cmake
glslang
pkg-config
qttools
wrapQtAppsHook
];
buildInputs = [
# vulkan-headers must come first, so the older propagated versions
# don't get picked up by accident
vulkan-headers
boost
catch2_3
cpp-jwt
cubeb
discord-rpc
# intentionally omitted: dynarmic - prefer vendored version for compatibility
enet
# vendored ffmpeg deps
autoconf
yasm
libva # for accelerated video decode on non-nvidia
nv-codec-headers-12 # for accelerated video decode on nvidia
# end vendored ffmpeg deps
fmt
# intentionally omitted: gamemode - loaded dynamically at runtime
# intentionally omitted: httplib - upstream requires an older version than what we have
libopus
libusb1
# intentionally omitted: LLVM - heavy, only used for stack traces in the debugger
lz4
nlohmann_json
qtbase
qtmultimedia
qtwayland
qtwebengine
# intentionally omitted: renderdoc - heavy, developer only
SDL2
# not packaged in nixpkgs: simpleini
# intentionally omitted: stb - header only libraries, vendor uses git snapshot
# not packaged in nixpkgs: vulkan-memory-allocator
# intentionally omitted: xbyak - prefer vendored version for compatibility
zlib
zstd
];
# This changes `ir/opt` to `ir/var/empty` in `externals/dynarmic/src/dynarmic/CMakeLists.txt`
# making the build fail, as that path does not exist
dontFixCmake = true;
cmakeFlags = [
# actually has a noticeable performance impact
"-DYUZU_ENABLE_LTO=ON"
# build with qt6
"-DENABLE_QT6=ON"
"-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"
# don't use system ffmpeg, yuzu uses internal APIs
"-DYUZU_USE_BUNDLED_FFMPEG=ON"
# don't check for missing submodules
"-DYUZU_CHECK_SUBMODULES=OFF"
# enable some optional features
"-DYUZU_USE_QT_WEB_ENGINE=ON"
"-DYUZU_USE_QT_MULTIMEDIA=ON"
"-DUSE_DISCORD_PRESENCE=ON"
# We dont want to bother upstream with potentially outdated compat reports
"-DYUZU_ENABLE_COMPATIBILITY_REPORTING=OFF"
"-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF" # We provide this deterministically
];
# Does some handrolled SIMD
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isx86_64 "-msse4.1";
# Fixes vulkan detection.
# FIXME: patchelf --add-rpath corrupts the binary for some reason, investigate
qtWrapperArgs = [
"--prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib"
];
preConfigure = ''
# see https://github.com/NixOS/nixpkgs/issues/114044, setting this through cmakeFlags does not work.
cmakeFlagsArray+=(
"-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 -s ${nx_tzdb} build/externals/nx_tzdb/nx_tzdb
'';
postInstall = ''
install -Dm444 $src/dist/72-yuzu-input.rules $out/lib/udev/rules.d/72-yuzu-input.rules
'';
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 = "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.
Using the early-access branch is recommended if you would like to try out experimental features, with a cost of stability.
'';
mainProgram = "yuzu";
platforms = [ "aarch64-linux" "x86_64-linux" ];
license = with licenses; [
gpl3Plus
# Icons
asl20 mit cc0
];
maintainers = with maintainers; [
ashley
ivar
joshuafern
sbruder
k900
];
};
})