2021-10-06 13:57:05 +00:00
|
|
|
{ lib
|
2022-10-21 18:38:19 +00:00
|
|
|
, stdenv
|
2021-10-06 13:57:05 +00:00
|
|
|
, fetchFromGitHub
|
2021-12-21 02:18:32 +00:00
|
|
|
, SDL2
|
2021-10-06 13:57:05 +00:00
|
|
|
, cmake
|
2023-07-15 17:15:38 +00:00
|
|
|
, cubeb
|
2021-12-21 02:18:32 +00:00
|
|
|
, curl
|
2021-10-06 13:57:05 +00:00
|
|
|
, extra-cmake-modules
|
2022-10-21 18:38:19 +00:00
|
|
|
, libXrandr
|
2023-10-09 19:29:22 +00:00
|
|
|
, libbacktrace
|
2024-02-29 20:09:43 +00:00
|
|
|
, makeWrapper
|
2021-12-21 02:18:32 +00:00
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, qtbase
|
2022-11-21 17:40:18 +00:00
|
|
|
, qtsvg
|
2021-12-21 02:18:32 +00:00
|
|
|
, qttools
|
2023-01-11 07:51:40 +00:00
|
|
|
, qtwayland
|
2023-10-09 19:29:22 +00:00
|
|
|
, substituteAll
|
2021-10-28 06:52:43 +00:00
|
|
|
, vulkan-loader
|
2022-11-21 17:40:18 +00:00
|
|
|
, wayland
|
2021-12-21 02:18:32 +00:00
|
|
|
, wrapQtAppsHook
|
2021-10-06 13:57:05 +00:00
|
|
|
}:
|
2021-12-21 02:18:32 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2021-01-05 17:05:55 +00:00
|
|
|
pname = "duckstation";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "0.1-6292";
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stenzek";
|
2022-11-21 17:40:18 +00:00
|
|
|
repo = "duckstation";
|
2024-02-29 20:09:43 +00:00
|
|
|
rev = "0bc42c38aab49030118f507c9783de047769148b";
|
|
|
|
hash = "sha256-8OavixSwEWihFY2fEdsepR1lqWlTH+//xZRKwb7lFCQ=";
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
2023-10-09 19:29:22 +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-29 20:09:43 +00:00
|
|
|
gitTag = "${finalAttrs.version}-g0bc42c38";
|
|
|
|
gitDate = "2024-02-06T22:47:47+09:00";
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-12-21 02:18:32 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2024-02-29 20:09:43 +00:00
|
|
|
extra-cmake-modules
|
2021-12-21 02:18:32 +00:00
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
qttools
|
|
|
|
wrapQtAppsHook
|
|
|
|
];
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
2021-12-21 02:18:32 +00:00
|
|
|
curl
|
2022-10-21 18:38:19 +00:00
|
|
|
libXrandr
|
2023-10-09 19:29:22 +00:00
|
|
|
libbacktrace
|
2021-12-21 02:18:32 +00:00
|
|
|
qtbase
|
2022-11-21 17:40:18 +00:00
|
|
|
qtsvg
|
2023-01-11 07:51:40 +00:00
|
|
|
qtwayland
|
|
|
|
wayland
|
2023-07-15 17:15:38 +00:00
|
|
|
]
|
|
|
|
++ cubeb.passthru.backendLibs;
|
2021-10-06 13:57:05 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
cmakeFlags = [
|
2023-10-09 19:29:22 +00:00
|
|
|
(lib.cmakeBool "BUILD_TESTS" true)
|
2022-10-21 18:38:19 +00:00
|
|
|
];
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
bin/common-tests
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
installPhase = ''
|
2021-10-06 13:57:05 +00:00
|
|
|
runHook preInstall
|
2021-12-21 02:18:32 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
mkdir -p $out/bin $out/share
|
2021-10-06 13:57:05 +00:00
|
|
|
|
|
|
|
cp -r bin $out/share/duckstation
|
2022-10-21 18:38:19 +00:00
|
|
|
ln -s $out/share/duckstation/duckstation-qt $out/bin/
|
2021-10-06 13:57:05 +00:00
|
|
|
|
2024-02-29 20:09:43 +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-21 02:18:32 +00:00
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2024-02-29 20:09:43 +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-28 06:52:43 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
meta = {
|
2021-01-05 17:05:55 +00:00
|
|
|
homepage = "https://github.com/stenzek/duckstation";
|
2021-12-21 02:18:32 +00:00
|
|
|
description = "Fast PlayStation 1 emulator for x86-64/AArch32/AArch64";
|
2023-10-09 19:29:22 +00:00
|
|
|
license = lib.licenses.gpl3Only;
|
2023-07-15 17:15:38 +00:00
|
|
|
mainProgram = "duckstation-qt";
|
2023-10-09 19:29:22 +00:00
|
|
|
maintainers = with lib.maintainers; [ guibou AndersonTorres ];
|
|
|
|
platforms = lib.platforms.linux;
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|