2021-10-04 04:27:33 +00:00
|
|
|
{ lib
|
2022-08-23 13:00:57 +00:00
|
|
|
, stdenv
|
2021-10-04 04:27:33 +00:00
|
|
|
, fetchFromGitHub
|
2021-12-19 15:19:14 +00:00
|
|
|
, SDL2
|
2021-10-04 04:27:33 +00:00
|
|
|
, cmake
|
2022-11-08 18:37:44 +00:00
|
|
|
, cubeb
|
2021-12-19 15:19:14 +00:00
|
|
|
, curl
|
2021-10-04 04:27:33 +00:00
|
|
|
, extra-cmake-modules
|
2022-08-23 13:00:57 +00:00
|
|
|
, libXrandr
|
2023-10-02 20:48:54 +00:00
|
|
|
, libbacktrace
|
2023-12-29 15:55:11 +00:00
|
|
|
, makeWrapper
|
2021-12-19 15:19:14 +00:00
|
|
|
, ninja
|
|
|
|
, pkg-config
|
2024-05-22 22:05:31 +00:00
|
|
|
, qt6
|
2023-10-02 20:48:54 +00:00
|
|
|
, substituteAll
|
2021-10-24 18:17:55 +00:00
|
|
|
, vulkan-loader
|
2022-08-23 13:00:57 +00:00
|
|
|
, wayland
|
2021-10-04 04:27:33 +00:00
|
|
|
}:
|
2021-12-19 15:19:14 +00:00
|
|
|
|
2024-05-22 22:05:31 +00:00
|
|
|
let
|
|
|
|
inherit (qt6)
|
|
|
|
qtbase
|
|
|
|
qtsvg
|
|
|
|
qttools
|
|
|
|
qtwayland
|
|
|
|
wrapQtAppsHook
|
|
|
|
;
|
|
|
|
in
|
2023-10-02 20:48:54 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-12-30 00:35:04 +00:00
|
|
|
pname = "duckstation";
|
2024-02-14 19:48:21 +00:00
|
|
|
version = "0.1-6292";
|
2022-11-19 03:00:00 +00:00
|
|
|
|
2020-12-30 00:35:04 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stenzek";
|
2022-11-19 03:00:00 +00:00
|
|
|
repo = "duckstation";
|
2024-02-14 19:48:21 +00:00
|
|
|
rev = "0bc42c38aab49030118f507c9783de047769148b";
|
|
|
|
hash = "sha256-8OavixSwEWihFY2fEdsepR1lqWlTH+//xZRKwb7lFCQ=";
|
2020-12-30 00:35:04 +00:00
|
|
|
};
|
|
|
|
|
2023-10-02 20:48:54 +00:00
|
|
|
patches = [
|
|
|
|
# Tests are not built by default
|
|
|
|
./001-fix-test-inclusion.diff
|
|
|
|
# Patching yet another script that fills data based on git commands...
|
|
|
|
(substituteAll {
|
|
|
|
src = ./002-hardcode-vars.diff;
|
|
|
|
gitHash = finalAttrs.src.rev;
|
|
|
|
gitBranch = "master";
|
2024-02-14 19:48:21 +00:00
|
|
|
gitTag = "${finalAttrs.version}-g0bc42c38";
|
|
|
|
gitDate = "2024-02-06T22:47:47+09:00";
|
2023-10-02 20:48:54 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-12-19 15:19:14 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2023-12-29 15:55:11 +00:00
|
|
|
extra-cmake-modules
|
2021-12-19 15:19:14 +00:00
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
qttools
|
|
|
|
wrapQtAppsHook
|
|
|
|
];
|
2020-12-30 00:35:04 +00:00
|
|
|
|
2021-10-04 04:27:33 +00:00
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
2021-12-19 15:19:14 +00:00
|
|
|
curl
|
2022-08-23 13:00:57 +00:00
|
|
|
libXrandr
|
2023-10-02 20:48:54 +00:00
|
|
|
libbacktrace
|
2021-12-19 15:19:14 +00:00
|
|
|
qtbase
|
2022-08-23 13:00:57 +00:00
|
|
|
qtsvg
|
2023-01-09 14:15:32 +00:00
|
|
|
qtwayland
|
|
|
|
wayland
|
2022-11-08 18:37:44 +00:00
|
|
|
]
|
|
|
|
++ cubeb.passthru.backendLibs;
|
2021-10-04 04:27:33 +00:00
|
|
|
|
2023-10-02 20:48:54 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2021-10-04 04:27:33 +00:00
|
|
|
cmakeFlags = [
|
2023-10-02 20:48:54 +00:00
|
|
|
(lib.cmakeBool "BUILD_TESTS" true)
|
2022-08-23 13:00:57 +00:00
|
|
|
];
|
2020-12-30 00:35:04 +00:00
|
|
|
|
2024-05-22 22:15:17 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
2023-10-02 20:48:54 +00:00
|
|
|
runHook preCheck
|
2024-05-22 22:15:17 +00:00
|
|
|
|
|
|
|
$out/share/duckstation/common-tests
|
|
|
|
|
2023-10-02 20:48:54 +00:00
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2020-12-30 00:35:04 +00:00
|
|
|
installPhase = ''
|
2021-10-04 04:27:33 +00:00
|
|
|
runHook preInstall
|
2021-12-19 15:19:14 +00:00
|
|
|
|
2022-08-23 13:00:57 +00:00
|
|
|
mkdir -p $out/bin $out/share
|
2021-10-04 04:27:33 +00:00
|
|
|
|
|
|
|
cp -r bin $out/share/duckstation
|
2022-08-23 13:00:57 +00:00
|
|
|
ln -s $out/share/duckstation/duckstation-qt $out/bin/
|
2021-10-04 04:27:33 +00:00
|
|
|
|
2023-12-29 15:55:11 +00:00
|
|
|
install -Dm644 $src/scripts/org.duckstation.DuckStation.desktop $out/share/applications/org.duckstation.DuckStation.desktop
|
|
|
|
install -Dm644 $src/scripts/org.duckstation.DuckStation.png $out/share/pixmaps/org.duckstation.DuckStation.png
|
2021-12-19 15:19:14 +00:00
|
|
|
|
2021-10-04 04:27:33 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2023-12-29 15:55:11 +00:00
|
|
|
qtWrapperArgs =
|
|
|
|
let
|
|
|
|
libPath = lib.makeLibraryPath ([
|
|
|
|
vulkan-loader
|
|
|
|
] ++ cubeb.passthru.backendLibs);
|
|
|
|
in [
|
|
|
|
"--prefix LD_LIBRARY_PATH : ${libPath}"
|
|
|
|
];
|
|
|
|
|
|
|
|
# https://github.com/stenzek/duckstation/blob/master/scripts/appimage/apprun-hooks/default-to-x11.sh
|
|
|
|
# Can't avoid the double wrapping, the binary wrapper from qtWrapperArgs doesn't support --run
|
|
|
|
postFixup = ''
|
|
|
|
source "${makeWrapper}/nix-support/setup-hook"
|
|
|
|
wrapProgram $out/bin/duckstation-qt \
|
|
|
|
--run 'if [[ -z $I_WANT_A_BROKEN_WAYLAND_UI ]]; then export QT_QPA_PLATFORM=xcb; fi'
|
|
|
|
'';
|
2021-10-24 18:17:55 +00:00
|
|
|
|
2023-10-02 20:48:54 +00:00
|
|
|
meta = {
|
2020-12-30 00:35:04 +00:00
|
|
|
homepage = "https://github.com/stenzek/duckstation";
|
2021-12-19 15:19:14 +00:00
|
|
|
description = "Fast PlayStation 1 emulator for x86-64/AArch32/AArch64";
|
2023-10-02 20:48:54 +00:00
|
|
|
license = lib.licenses.gpl3Only;
|
2023-07-12 13:30:17 +00:00
|
|
|
mainProgram = "duckstation-qt";
|
2023-10-02 20:48:54 +00:00
|
|
|
maintainers = with lib.maintainers; [ guibou AndersonTorres ];
|
|
|
|
platforms = lib.platforms.linux;
|
2020-12-30 00:35:04 +00:00
|
|
|
};
|
2023-10-02 20:48:54 +00:00
|
|
|
})
|