pcsx2: big rewrite

- Gather all the sources in a same expression under sources.nix
- Doc-comment and rename the patch
- strictDeps is set as true
  - Why extra-cmake-modules does not work in nativeBuildInputs??
- Add myself as maintainer
This commit is contained in:
Anderson Torres
2024-07-10 22:01:16 -03:00
parent eb7ef344a0
commit f277070801
4 changed files with 79 additions and 58 deletions
+15 -23
View File
@@ -28,14 +28,7 @@
}:
let
shaderc-patched = callPackage ./shaderc-patched.nix { };
# The pre-zipped files in releases don't have a versioned link, we need to zip them ourselves
pcsx2_patches = fetchFromGitHub {
owner = "PCSX2";
repo = "pcsx2_patches";
rev = "9e71956797332471010e563a4b75a5934bef9d4e";
hash = "sha256-jpaRpvJox78zRGyrVIGYVoSEo/ICBlBfw3dTMz9QGuU=";
};
sources = callPackage ./sources.nix { };
inherit (qt6)
qtbase
qtsvg
@@ -45,18 +38,12 @@ let
;
in
llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
pname = "pcsx2";
version = "1.7.5919";
inherit (sources.pcsx2) pname version src;
src = fetchFromGitHub {
owner = "PCSX2";
repo = "pcsx2";
rev = "v${finalAttrs.version}";
# NOTE: Don't forget to change the hash in shaderc-patched.nix as well.
hash = "sha256-cDugEbbz40uLPW64bcDGxfo1Y3ahYnEVaalfMp/J95s=";
};
patches = [ ./define-rev.patch ];
patches = [
# Remove PCSX2_GIT_REV
./0000-define-rev.patch
];
cmakeFlags = [
(lib.cmakeBool "DISABLE_ADVANCE_SIMD" true)
@@ -66,7 +53,6 @@ llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
cmake
extra-cmake-modules
pkg-config
strip-nondeterminism
wrapQtAppsHook
@@ -75,6 +61,7 @@ llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
buildInputs = [
curl
extra-cmake-modules
ffmpeg
libaio
libbacktrace
@@ -87,13 +74,15 @@ llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
qttools
qtwayland
SDL2
shaderc-patched
sources.shaderc-patched
soundtouch
vulkan-headers
wayland
zstd
] ++ cubeb.passthru.backendLibs;
strictDeps = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
@@ -102,7 +91,7 @@ llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
install -Dm644 $src/pcsx2-qt/resources/icons/AppIcon64.png $out/share/pixmaps/PCSX2.png
install -Dm644 $src/.github/workflows/scripts/linux/pcsx2-qt.desktop $out/share/applications/PCSX2.desktop
zip -jq $out/bin/resources/patches.zip ${pcsx2_patches}/patches/*
zip -jq $out/bin/resources/patches.zip ${sources.pcsx2_patches.src}/patches/*
strip-nondeterminism $out/bin/resources/patches.zip
runHook postInstall
'';
@@ -112,7 +101,7 @@ llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
libs = lib.makeLibraryPath (
[
vulkan-loader
shaderc-patched
sources.shaderc-patched
]
++ cubeb.passthru.backendLibs
);
@@ -137,12 +126,15 @@ llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
system memory. This allows you to play PS2 games on your PC, with many
additional features and benefits.
'';
changelog = "https://github.com/PCSX2/pcsx2/releases/tag/v${finalAttrs.version}";
downloadPage = "https://github.com/PCSX2/pcsx2";
license = with lib.licenses; [
gpl3Plus
lgpl3Plus
];
mainProgram = "pcsx2-qt";
maintainers = with lib.maintainers; [
AndersonTorres
hrdinka
govanify
matteopacini
-35
View File
@@ -1,35 +0,0 @@
{
lib,
fetchFromGitHub,
fetchpatch,
pcsx2,
shaderc,
}:
let
version = "2024.1";
in
shaderc.overrideAttrs (old: {
inherit version;
pname = "shaderc-patched-for-pcsx2";
src = fetchFromGitHub {
owner = "google";
repo = "shaderc";
rev = "v${version}";
hash = "sha256-2L/8n6KLVZWXt6FrYraVlZV5YqbPHD7rzXPCkD0d4kg=";
};
patches = (old.patches or [ ]) ++ [
(fetchpatch {
url = "file://${pcsx2.src}/.github/workflows/scripts/common/shaderc-changes.patch";
hash = "sha256-/qX2yD0RBuPh4Cf7n6OjVA2IyurpaCgvCEsIX/hXFdQ=";
excludes = [
"libshaderc/CMakeLists.txt"
"third_party/CMakeLists.txt"
];
})
];
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
(lib.cmakeBool "SHADERC_SKIP_EXAMPLES" true)
(lib.cmakeBool "SHADERC_SKIP_TESTS" true)
];
})
+64
View File
@@ -0,0 +1,64 @@
{
lib,
fetchFromGitHub,
fetchpatch,
pcsx2,
shaderc,
}:
{
pcsx2 = let
self = {
pname = "pcsx2";
version = "1.7.5919";
src = fetchFromGitHub {
owner = "PCSX2";
repo = "pcsx2";
rev = "v${self.version}";
hash = "sha256-cDugEbbz40uLPW64bcDGxfo1Y3ahYnEVaalfMp/J95s=";
};
};
in
self;
# The pre-zipped files in releases don't have a versioned link, we need to zip
# them ourselves
pcsx2_patches = {
pname = "pcsx2_patches";
version = "0-unstable-2024-06-23";
src = fetchFromGitHub {
owner = "PCSX2";
repo = "pcsx2_patches";
rev = "9e71956797332471010e563a4b75a5934bef9d4e";
hash = "sha256-jpaRpvJox78zRGyrVIGYVoSEo/ICBlBfw3dTMz9QGuU=";
};
};
shaderc-patched = let
pname = "shaderc-patched-for-pcsx2";
version = "2024.1";
src = fetchFromGitHub {
owner = "google";
repo = "shaderc";
rev = "v${version}";
hash = "sha256-2L/8n6KLVZWXt6FrYraVlZV5YqbPHD7rzXPCkD0d4kg=";
};
in
shaderc.overrideAttrs (old: {
inherit pname version src;
patches = (old.patches or [ ]) ++ [
(fetchpatch {
url = "file://${pcsx2.src}/.github/workflows/scripts/common/shaderc-changes.patch";
hash = "sha256-/qX2yD0RBuPh4Cf7n6OjVA2IyurpaCgvCEsIX/hXFdQ=";
excludes = [
"libshaderc/CMakeLists.txt"
"third_party/CMakeLists.txt"
];
})
];
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
(lib.cmakeBool "SHADERC_SKIP_EXAMPLES" true)
(lib.cmakeBool "SHADERC_SKIP_TESTS" true)
];
});
}