mirror of
https://git.suyu.dev/suyu/nix-flake
synced 2024-11-21 14:29:10 -07:00
real initial commit
This commit is contained in:
commit
2c679529de
6 changed files with 278 additions and 0 deletions
27
flake.lock
Normal file
27
flake.lock
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1714253743,
|
||||
"narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
23
flake.nix
Normal file
23
flake.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
description = "A flake of an experimental Nintendo Switch emulator written in C++";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
packages.x86_64-linux =
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
config = {allowUnfree = true;};
|
||||
};
|
||||
suyu-deps = pkgs.kdePackages // {inherit (self.packages.x86_64-linux) nx_tzdb compat-list;};
|
||||
in {
|
||||
default = self.packages.x86_64-linux.suyu;
|
||||
nx_tzdb = pkgs.callPackage ./suyu/nx_tzdb.nix {};
|
||||
compat-list = pkgs.callPackage ./suyu/compat-list.nix {};
|
||||
suyu = pkgs.callPackage ./suyu/suyu.nix suyu-deps;
|
||||
};
|
||||
};
|
||||
}
|
18
suyu/compat-list.nix
Normal file
18
suyu/compat-list.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ stdenv, fetchFromGitHub, unstableGitUpdater }:
|
||||
stdenv.mkDerivation {
|
||||
pname = "yuzu-compatibility-list";
|
||||
version = "unstable-2024-02-26";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "flathub";
|
||||
repo = "org.yuzu_emu.yuzu";
|
||||
rev = "9c2032a3c7e64772a8112b77ed8b660242172068";
|
||||
hash = "sha256-ITh/W4vfC9w9t+TJnPeTZwWifnhTNKX54JSSdpgaoBk=";
|
||||
};
|
||||
|
||||
buildCommand = ''
|
||||
cp $src/compatibility_list.json $out
|
||||
'';
|
||||
|
||||
passthru.updateScript = unstableGitUpdater {};
|
||||
}
|
0
suyu/default.nix
Normal file
0
suyu/default.nix
Normal file
20
suyu/nx_tzdb.nix
Normal file
20
suyu/nx_tzdb.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ stdenv, fetchurl, unzip, 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=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
||||
buildCommand = ''
|
||||
unzip $src -d $out
|
||||
'';
|
||||
|
||||
passthru.updateScript = gitUpdater {
|
||||
url = "https://github.com/lat9nq/tzdb_to_nx.git";
|
||||
};
|
||||
}
|
190
suyu/suyu.nix
Normal file
190
suyu/suyu.nix
Normal file
|
@ -0,0 +1,190 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchgit
|
||||
, nix-update-script
|
||||
, wrapQtAppsHook
|
||||
, autoconf
|
||||
, boost
|
||||
, catch2_3
|
||||
, cmake
|
||||
, compat-list
|
||||
, cpp-jwt
|
||||
, cubeb
|
||||
, discord-rpc
|
||||
, enet
|
||||
, fmt
|
||||
, glslang
|
||||
, libopus
|
||||
, libusb1
|
||||
, libva
|
||||
, lz4
|
||||
, nlohmann_json
|
||||
, nv-codec-headers-12
|
||||
, nx_tzdb
|
||||
, pkg-config
|
||||
, qtbase
|
||||
, qtmultimedia
|
||||
, qttools
|
||||
, qtwayland
|
||||
, qtwebengine
|
||||
, SDL2
|
||||
, vulkan-headers
|
||||
, vulkan-loader
|
||||
, yasm
|
||||
, zlib
|
||||
, zstd
|
||||
, ...
|
||||
}:
|
||||
stdenv.mkDerivation(finalAttrs: {
|
||||
pname = "suyu";
|
||||
version = "0.0.3";
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://git.suyu.dev/suyu/suyu";
|
||||
rev = "v${finalAttrs.version}";
|
||||
sha256 = lib.fakeSha256;
|
||||
};
|
||||
|
||||
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
|
||||
"-DSUYUENABLE_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"
|
||||
"-DSUYUUSE_EXTERNAL_SDL2=OFF"
|
||||
"-DSUYUUSE_EXTERNAL_VULKAN_HEADERS=OFF"
|
||||
|
||||
# don't use system ffmpeg, suyu uses internal APIs
|
||||
"-DSUYUUSE_BUNDLED_FFMPEG=ON"
|
||||
|
||||
# don't check for missing submodules
|
||||
"-DSUYUCHECK_SUBMODULES=OFF"
|
||||
|
||||
# enable some optional features
|
||||
"-DSUYUUSE_QT_WEB_ENGINE=ON"
|
||||
"-DSUYUUSE_QT_MULTIMEDIA=ON"
|
||||
"-DUSE_DISCORD_PRESENCE=ON"
|
||||
|
||||
# We dont want to bother upstream with potentially outdated compat reports
|
||||
"-DSUYUENABLE_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
|
||||
'';
|
||||
|
||||
postConfigure = ''
|
||||
ln -sf ${compat-list} ./dist/compatibility_list/compatibility_list.json
|
||||
'';
|
||||
|
||||
|
||||
postInstall = "
|
||||
install -Dm444 $src/dist/72-suyu-input.rules $out/lib/udev/rules.d/72-suyu-input.rules
|
||||
";
|
||||
|
||||
passthru.updateScript = nix-update-script {
|
||||
extraArgs = [ "--version-regex" "mainline-0-(.*)" ];
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://suyu.dev";
|
||||
changelog = "https://suyu.dev/blog";
|
||||
description = "An experimental Nintendo Switch emulator written in C++";
|
||||
longDescription = ''
|
||||
An experimental Nintendo Switch emulator written in C++.
|
||||
Using the master/ branch is recommended for general usage.
|
||||
Using the dev branch is recommended if you would like to try out experimental features, with a cost of stability.
|
||||
'';
|
||||
mainProgram = "suyu";
|
||||
platforms = [ "aarch64-linux" "x86_64-linux" ];
|
||||
license = with licenses; [
|
||||
gpl3Plus
|
||||
# Icons
|
||||
asl20 mit cc0
|
||||
];
|
||||
maintainers = with maintainers; [
|
||||
ashley
|
||||
ivar
|
||||
joshuafern
|
||||
sbruder
|
||||
k900
|
||||
];
|
||||
};
|
||||
})
|
Loading…
Reference in a new issue