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
|
2022-10-21 18:38:19 +00:00
|
|
|
, copyDesktopItems
|
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
|
2022-11-21 17:40:18 +00:00
|
|
|
, libpulseaudio
|
|
|
|
, makeDesktopItem
|
2022-10-21 18:38:19 +00:00
|
|
|
, mesa # for libgbm
|
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
|
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
|
2022-11-21 17:40:18 +00:00
|
|
|
, enableWayland ? true
|
2021-10-06 13:57:05 +00:00
|
|
|
}:
|
2021-12-21 02:18:32 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
stdenv.mkDerivation {
|
2021-01-05 17:05:55 +00:00
|
|
|
pname = "duckstation";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "unstable-2022-11-18";
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "stenzek";
|
2022-11-21 17:40:18 +00:00
|
|
|
repo = "duckstation";
|
|
|
|
rev = "8d7aea5e19859ed483699cc4a5dbd47165c7be8b";
|
|
|
|
sha256 = "sha256-92Wn1ZEEZszmVK/KrJqjDuQf/lyD8/VScfTI/St5dY4=";
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
2021-12-21 02:18:32 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
extra-cmake-modules
|
2022-10-21 18:38:19 +00:00
|
|
|
copyDesktopItems
|
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
|
2021-10-06 13:57:05 +00:00
|
|
|
libpulseaudio
|
2022-10-21 18:38:19 +00:00
|
|
|
libXrandr
|
2021-12-21 02:18:32 +00:00
|
|
|
mesa
|
|
|
|
qtbase
|
2022-11-21 17:40:18 +00:00
|
|
|
qtsvg
|
2021-10-28 06:52:43 +00:00
|
|
|
vulkan-loader
|
2022-11-21 17:40:18 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals enableWayland [ wayland ];
|
2021-10-06 13:57:05 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2021-12-21 02:18:32 +00:00
|
|
|
"-DUSE_DRMKMS=ON"
|
2022-11-21 17:40:18 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals enableWayland [ "-DUSE_WAYLAND=ON" ];
|
2021-10-06 13:57:05 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "duckstation-qt";
|
|
|
|
desktopName = "DuckStation";
|
|
|
|
genericName = "PlayStation 1 Emulator";
|
|
|
|
icon = "duckstation";
|
|
|
|
tryExec = "duckstation-qt";
|
|
|
|
exec = "duckstation-qt %f";
|
|
|
|
comment = "Fast PlayStation 1 emulator";
|
|
|
|
categories = [ "Game" "Emulator" "Qt" ];
|
|
|
|
type = "Application";
|
|
|
|
})
|
|
|
|
];
|
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
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
install -Dm644 bin/resources/images/duck.png $out/share/pixmaps/duckstation.png
|
2021-12-21 02:18:32 +00:00
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
2022-10-21 18:38:19 +00:00
|
|
|
bin/common-tests
|
2021-10-06 13:57:05 +00:00
|
|
|
runHook postCheck
|
2021-01-05 17:05:55 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
# Libpulseaudio fixes https://github.com/NixOS/nixpkgs/issues/171173
|
2021-10-28 06:52:43 +00:00
|
|
|
qtWrapperArgs = [
|
2022-10-21 18:38:19 +00:00
|
|
|
"--set QT_QPA_PLATFORM xcb"
|
2022-05-18 14:49:53 +00:00
|
|
|
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libpulseaudio vulkan-loader ]}"
|
2021-10-28 06:52:43 +00:00
|
|
|
];
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/stenzek/duckstation";
|
2021-12-21 02:18:32 +00:00
|
|
|
description = "Fast PlayStation 1 emulator for x86-64/AArch32/AArch64";
|
2021-10-06 13:57:05 +00:00
|
|
|
license = licenses.gpl3Only;
|
2021-12-21 02:18:32 +00:00
|
|
|
maintainers = with maintainers; [ guibou AndersonTorres ];
|
2021-01-05 17:05:55 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|