about summary refs log tree commit diff
path: root/pkgs/by-name/pc/pcsx2-bin/package.nix
blob: a3c868de23bf73825ffb58dba1da2f8007104e9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
  lib,
  stdenvNoCC,
  fetchurl,
  makeWrapper,
  # To grab metadata
  pcsx2,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "pcsx2";
  version = "1.7.5919";

  src = fetchurl {
    url = "https://github.com/PCSX2/pcsx2/releases/download/v${finalAttrs.version}/pcsx2-v${finalAttrs.version}-macos-Qt.tar.xz";
    hash = "sha256-NYgHsYXoIhI2pxqqiMgz5sKBAezEFf4AfEfu5S3diMg=";
  };

  nativeBuildInputs = [ makeWrapper ];

  dontPatch = true;
  dontConfigure = true;
  dontBuild = true;

  sourceRoot = ".";

  installPhase = ''
    runHook preInstall
    mkdir -p $out/{bin,Applications}
    cp -r "PCSX2-v${finalAttrs.version}.app" $out/Applications/PCSX2.app
    makeWrapper $out/Applications/PCSX2.app/Contents/MacOS/PCSX2 $out/bin/pcsx2-qt
    runHook postInstall
  '';

  meta = {
    inherit (pcsx2.meta) homepage longDescription license changelog downloadPage;
    description = "Playstation 2 emulator; precompiled binary for MacOS, repacked from official website";
    maintainers = with lib.maintainers; [
      matteopacini
    ];
    mainProgram = "pcsx2-qt";
    platforms = lib.systems.inspect.patternLogicalAnd
      lib.systems.inspect.patterns.isDarwin
      lib.systems.inspect.patterns.isx86_64;
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
  };
})