diff --git a/default.nix b/default.nix index 50ca373..183d700 100644 --- a/default.nix +++ b/default.nix @@ -29,6 +29,7 @@ labwc-with-ws4waybar = pkgs.callPackage ./pkgs/labwc-with-ws4waybar { }; waybar-Consolatis-fork = pkgs.callPackage ./pkgs/waybar-Consolatis-fork { }; shotcut = pkgs.callPackage ./pkgs/shotcut { }; + ppsspp = pkgs.callPackage ./pkgs/ppsspp { }; # some-qt5-package = pkgs.libsForQt5.callPackage ./pkgs/some-qt5-package { }; # ... # ... diff --git a/pkgs/ppsspp/default.nix b/pkgs/ppsspp/default.nix new file mode 100644 index 0000000..6b7a8ce --- /dev/null +++ b/pkgs/ppsspp/default.nix @@ -0,0 +1,136 @@ +{ + lib, + SDL2, + cmake, + copyDesktopItems, + fetchFromGitHub, + ffmpeg_6, + glew, + libffi, + libsForQt5, + libzip, + makeDesktopItem, + makeWrapper, + pkg-config, + python3, + snappy, + stdenv, + vulkan-loader, + wayland, + zlib, +}: + +let + inherit (libsForQt5) qtbase qtmultimedia wrapQtAppsHook; +in +stdenv.mkDerivation rec { + pname = "ppsspp"; + version = "1.18.1"; + + src = fetchFromGitHub { + owner = "hrydgard"; + repo = "ppsspp"; + rev = "v${version}"; + fetchSubmodules = true; + hash = "sha256-X5Sb6oxjjhlsm1VN9e0Emk4SqiHTe3G3ZiuIgw5DSds="; + }; + + postPatch = '' + substituteInPlace git-version.cmake --replace-warn unknown ${src.rev} + substituteInPlace UI/NativeApp.cpp --replace-fail /usr/share $out/share + ''; + + nativeBuildInputs = [ + cmake + copyDesktopItems + makeWrapper + pkg-config + python3 + wrapQtAppsHook + ]; + + buildInputs = [ + SDL2 + glew + libzip + zlib + ffmpeg_6 + snappy + qtbase + vulkan-loader + wayland + libffi + qtmultimedia + ]; + + dontWrapQtApps = true; + + cmakeFlags = [ + (lib.cmakeBool "USE_SYSTEM_FFMPEG" false) + (lib.cmakeBool "USE_SYSTEM_LIBZIP" true) + (lib.cmakeBool "USE_SYSTEM_SNAPPY" true) + (lib.cmakeBool "USE_WAYLAND_WSI" true) + (lib.cmakeBool "USING_QT_UI" true) + (lib.cmakeFeature "OpenGL_GL_PREFERENCE" "GLVND") + ]; + + desktopItems = [ + (makeDesktopItem { + desktopName = "PPSSPP"; + name = "ppsspp"; + exec = "ppsspp"; + icon = "ppsspp"; + comment = "ppsspp (fast and portable PSP emulator)"; + categories = [ "Game" "Emulator" ]; + keywords = ["Sony" "PlayStation" "Portable" "PSP" "handheld" "console"]; + }) + ]; + + installPhase ='' + runHook preInstall + mkdir -p $out/share/icons + mkdir -p $out/share/ppsspp + mkdir -p $out/bin + # Install assets + mv assets $out/share/ppsspp/assets + # Install Binary + install -Dm555 PPSSPPQt $out/share/ppsspp + # Install Icons + for res in 16 24 32 48 64 96 128 256 512; do + install -Dm644 \ + ../icons/hicolor/''${res}x''${res}/apps/ppsspp.png \ + $out/share/icons/hicolor/''${res}x''${res}/apps/ppsspp.png + install -Dm644 \ + ../icons/hicolor/''${res}x''${res}/apps/ppsspp.png \ + $out/share/icons/hicolor/''${res}x''${res}/apps/PPSSPPQt.png + done + # Wrapping QT + wrapQtApp $out/share/ppsspp/PPSSPPQt + makeWrapper $out/share/ppsspp/PPSSPPQt $out/bin/ppsspp \ + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ vulkan-loader ]} + runHook postInstall + ''; + + postFixup = '' + + ''; + + meta = { + homepage = "https://www.ppsspp.org/"; + description = "HLE Playstation Portable emulator, written in C++ (QT)"; + longDescription = '' + PPSSPP is a PSP emulator, which means that it can run games and other + software that was originally made for the Sony PSP. + + The PSP had multiple types of software. The two most common are native PSP + games on UMD discs and downloadable games (that were stored in the + directory PSP/GAME on the "memory stick"). But there were also UMD Video + discs, and PS1 games that could run in a proprietary emulator. PPSSPP does + not run those. + ''; + license = lib.licenses.gpl2Plus; + maintainers = [ lib.maintainers.AndersonTorres ]; + mainProgram = "ppsspp"; + platforms = lib.platforms.linux; + }; +}