2021-10-06 13:57:05 +00:00
|
|
|
{ lib
|
|
|
|
, mkDerivation
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, extra-cmake-modules
|
|
|
|
, pkg-config
|
|
|
|
, SDL2
|
|
|
|
, qtbase
|
|
|
|
, wrapQtAppsHook
|
|
|
|
, qttools
|
|
|
|
, ninja
|
|
|
|
, gtk3
|
|
|
|
, libevdev
|
|
|
|
, curl
|
|
|
|
, libpulseaudio
|
|
|
|
, sndio
|
|
|
|
, mesa
|
2021-10-28 06:52:43 +00:00
|
|
|
, vulkan-loader
|
|
|
|
, wayland
|
2021-10-06 13:57:05 +00:00
|
|
|
}:
|
2021-01-05 17:05:55 +00:00
|
|
|
mkDerivation rec {
|
|
|
|
pname = "duckstation";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "unstable-2021-10-29";
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stenzek";
|
|
|
|
repo = pname;
|
2021-12-06 16:07:01 +00:00
|
|
|
rev = "287b1e1abc98ef3f01d8530e0b428b58d8e77e96";
|
|
|
|
sha256 = "sha256-1s7oBdOOkK6a3DKCZ70dAilFzlzrURwhx+MRTmOPWJE=";
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
nativeBuildInputs = [ cmake ninja pkg-config extra-cmake-modules wrapQtAppsHook qttools ];
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
|
|
|
qtbase
|
|
|
|
gtk3
|
|
|
|
libevdev
|
|
|
|
sndio
|
|
|
|
mesa
|
|
|
|
curl
|
|
|
|
libpulseaudio
|
2021-10-28 06:52:43 +00:00
|
|
|
wayland
|
|
|
|
vulkan-loader
|
2021-10-06 13:57:05 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2021-12-06 16:07:01 +00:00
|
|
|
"-DUSE_DRMKMS=ON" # Broken in combination with Wayland, https://github.com/stenzek/duckstation/issues/2630
|
2021-10-28 06:52:43 +00:00
|
|
|
"-DUSE_WAYLAND=ON"
|
2021-10-06 13:57:05 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace extras/linux-desktop-files/duckstation-qt.desktop \
|
|
|
|
--replace "duckstation-qt" "duckstation" \
|
|
|
|
--replace "TryExec=duckstation" "tryExec=duckstation-qt" \
|
|
|
|
--replace "Exec=duckstation" "Exec=duckstation-qt"
|
|
|
|
substituteInPlace extras/linux-desktop-files/duckstation-nogui.desktop \
|
|
|
|
--replace "duckstation-nogui" "duckstation" \
|
|
|
|
--replace "TryExec=duckstation" "tryExec=duckstation-nogui" \
|
|
|
|
--replace "Exec=duckstation" "Exec=duckstation-nogui"
|
|
|
|
'';
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-10-06 13:57:05 +00:00
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin $out/share $out/share/pixmaps $out/share/applications
|
|
|
|
rm bin/common-tests
|
|
|
|
|
|
|
|
cp -r bin $out/share/duckstation
|
|
|
|
ln -s $out/share/duckstation/duckstation-{qt,nogui} $out/bin/
|
|
|
|
|
|
|
|
cp ../extras/icons/icon-256px.png $out/share/pixmaps/duckstation.png
|
|
|
|
cp ../extras/linux-desktop-files/* $out/share/applications/
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
./bin/common-tests
|
|
|
|
runHook postCheck
|
2021-01-05 17:05:55 +00:00
|
|
|
'';
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
qtWrapperArgs = [
|
|
|
|
"--prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib"
|
|
|
|
];
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
# TODO:
|
2021-10-28 06:52:43 +00:00
|
|
|
# - default sound backend (cubeb) does not work, but SDL does. Strangely, switching to cubeb while a game is running makes it work.
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
meta = with lib; {
|
2021-10-06 13:57:05 +00:00
|
|
|
description = "PlayStation 1 emulator focusing on playability, speed and long-term maintainability";
|
2021-01-05 17:05:55 +00:00
|
|
|
homepage = "https://github.com/stenzek/duckstation";
|
2021-10-06 13:57:05 +00:00
|
|
|
license = licenses.gpl3Only;
|
2021-01-05 17:05:55 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.guibou ];
|
|
|
|
};
|
|
|
|
}
|