2021-10-04 06:27:33 +02:00
|
|
|
{ lib
|
2022-08-23 15:00:57 +02:00
|
|
|
, stdenv
|
2021-10-04 06:27:33 +02:00
|
|
|
, fetchFromGitHub
|
2021-12-19 16:19:14 +01:00
|
|
|
, SDL2
|
2021-10-04 06:27:33 +02:00
|
|
|
, cmake
|
2022-08-23 15:00:57 +02:00
|
|
|
, copyDesktopItems
|
2021-12-19 16:19:14 +01:00
|
|
|
, curl
|
2021-10-04 06:27:33 +02:00
|
|
|
, extra-cmake-modules
|
2022-08-23 15:00:57 +02:00
|
|
|
, libXrandr
|
2022-11-19 04:00:00 +01:00
|
|
|
, libpulseaudio
|
|
|
|
, makeDesktopItem
|
2022-08-23 15:00:57 +02:00
|
|
|
, mesa # for libgbm
|
2021-12-19 16:19:14 +01:00
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, qtbase
|
2022-08-23 15:00:57 +02:00
|
|
|
, qtsvg
|
2021-12-19 16:19:14 +01:00
|
|
|
, qttools
|
2021-10-24 20:17:55 +02:00
|
|
|
, vulkan-loader
|
2022-08-23 15:00:57 +02:00
|
|
|
, wayland
|
2021-12-19 16:19:14 +01:00
|
|
|
, wrapQtAppsHook
|
2022-11-19 04:00:00 +01:00
|
|
|
, enableWayland ? true
|
2021-10-04 06:27:33 +02:00
|
|
|
}:
|
2021-12-19 16:19:14 +01:00
|
|
|
|
2022-11-19 04:00:00 +01:00
|
|
|
stdenv.mkDerivation {
|
2020-12-30 01:35:04 +01:00
|
|
|
pname = "duckstation";
|
2022-12-10 22:30:38 +01:00
|
|
|
version = "unstable-2022-12-08";
|
2022-11-19 04:00:00 +01:00
|
|
|
|
2020-12-30 01:35:04 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stenzek";
|
2022-11-19 04:00:00 +01:00
|
|
|
repo = "duckstation";
|
2022-12-10 22:30:38 +01:00
|
|
|
rev = "1905ce3e0163fd53e56cc949379f74a2e1c6228d";
|
|
|
|
sha256 = "sha256-q6r9VCGwYCTzyZ3s1BAhQiA8FKsue7QUcErGtuLJbCg=";
|
2020-12-30 01:35:04 +01:00
|
|
|
};
|
|
|
|
|
2021-12-19 16:19:14 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
extra-cmake-modules
|
2022-08-23 15:00:57 +02:00
|
|
|
copyDesktopItems
|
2021-12-19 16:19:14 +01:00
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
qttools
|
|
|
|
wrapQtAppsHook
|
|
|
|
];
|
2020-12-30 01:35:04 +01:00
|
|
|
|
2021-10-04 06:27:33 +02:00
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
2021-12-19 16:19:14 +01:00
|
|
|
curl
|
2021-10-04 06:27:33 +02:00
|
|
|
libpulseaudio
|
2022-08-23 15:00:57 +02:00
|
|
|
libXrandr
|
2021-12-19 16:19:14 +01:00
|
|
|
mesa
|
|
|
|
qtbase
|
2022-08-23 15:00:57 +02:00
|
|
|
qtsvg
|
2021-10-24 20:17:55 +02:00
|
|
|
vulkan-loader
|
2022-11-19 04:00:00 +01:00
|
|
|
]
|
|
|
|
++ lib.optionals enableWayland [ wayland ];
|
2021-10-04 06:27:33 +02:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2021-12-19 16:19:14 +01:00
|
|
|
"-DUSE_DRMKMS=ON"
|
2022-11-19 04:00:00 +01:00
|
|
|
]
|
|
|
|
++ lib.optionals enableWayland [ "-DUSE_WAYLAND=ON" ];
|
2021-10-04 06:27:33 +02:00
|
|
|
|
2022-08-23 15:00:57 +02:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
2022-10-07 11:42:21 +02:00
|
|
|
name = "duckstation-qt";
|
|
|
|
desktopName = "DuckStation";
|
2022-08-23 15:00:57 +02:00
|
|
|
genericName = "PlayStation 1 Emulator";
|
|
|
|
icon = "duckstation";
|
|
|
|
tryExec = "duckstation-qt";
|
|
|
|
exec = "duckstation-qt %f";
|
|
|
|
comment = "Fast PlayStation 1 emulator";
|
|
|
|
categories = [ "Game" "Emulator" "Qt" ];
|
2022-10-07 11:42:21 +02:00
|
|
|
type = "Application";
|
2022-08-23 15:00:57 +02:00
|
|
|
})
|
|
|
|
];
|
2020-12-30 01:35:04 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-10-04 06:27:33 +02:00
|
|
|
runHook preInstall
|
2021-12-19 16:19:14 +01:00
|
|
|
|
2022-08-23 15:00:57 +02:00
|
|
|
mkdir -p $out/bin $out/share
|
2021-10-04 06:27:33 +02:00
|
|
|
|
|
|
|
cp -r bin $out/share/duckstation
|
2022-08-23 15:00:57 +02:00
|
|
|
ln -s $out/share/duckstation/duckstation-qt $out/bin/
|
2021-10-04 06:27:33 +02:00
|
|
|
|
2022-08-23 15:00:57 +02:00
|
|
|
install -Dm644 bin/resources/images/duck.png $out/share/pixmaps/duckstation.png
|
2021-12-19 16:19:14 +01:00
|
|
|
|
2021-10-04 06:27:33 +02:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
2022-08-23 15:00:57 +02:00
|
|
|
bin/common-tests
|
2021-10-04 06:27:33 +02:00
|
|
|
runHook postCheck
|
2020-12-30 01:35:04 +01:00
|
|
|
'';
|
|
|
|
|
2022-05-07 16:27:51 +02:00
|
|
|
# Libpulseaudio fixes https://github.com/NixOS/nixpkgs/issues/171173
|
2021-10-24 20:17:55 +02:00
|
|
|
qtWrapperArgs = [
|
2022-10-07 11:42:21 +02:00
|
|
|
"--set QT_QPA_PLATFORM xcb"
|
2022-05-07 16:27:51 +02:00
|
|
|
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libpulseaudio vulkan-loader ]}"
|
2021-10-24 20:17:55 +02:00
|
|
|
];
|
|
|
|
|
2020-12-30 01:35:04 +01:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/stenzek/duckstation";
|
2021-12-19 16:19:14 +01:00
|
|
|
description = "Fast PlayStation 1 emulator for x86-64/AArch32/AArch64";
|
2021-10-04 06:27:33 +02:00
|
|
|
license = licenses.gpl3Only;
|
2021-12-19 16:19:14 +01:00
|
|
|
maintainers = with maintainers; [ guibou AndersonTorres ];
|
2020-12-30 01:35:04 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|