|
1 | 1 | { |
2 | 2 | lib, |
| 3 | + stdenv, |
| 4 | + fetchFromGitHub, |
| 5 | + replaceVars, |
| 6 | + |
| 7 | + wrapQtAppsHook ? null, |
| 8 | + |
| 9 | + qtbase ? null, |
| 10 | + qttools ? null, |
| 11 | + qtmultimedia ? null, |
| 12 | + |
| 13 | + withGUI ? false, |
3 | 14 | callPackage, |
| 15 | + symlinkJoin, |
4 | 16 | }: |
5 | 17 |
|
6 | | -callPackage ./emulator.nix { } // { |
7 | | - meta = { |
8 | | - description = "Early in development PS4 emulator"; |
9 | | - homepage = "https://github.com/shadps4-emu/shadPS4"; |
10 | | - license = lib.licenses.gpl2Plus; |
11 | | - maintainers = with lib.maintainers; [ |
12 | | - ryand56 |
13 | | - liberodark |
14 | | - ]; |
15 | | - mainProgram = "shadps4"; |
16 | | - platforms = lib.intersectLists lib.platforms.linux lib.platforms.x86_64; |
| 18 | +let |
| 19 | + emulator = callPackage ./emulator.nix { }; |
| 20 | + |
| 21 | + shadps4 = symlinkJoin { |
| 22 | + name = "shadps4-wrapped"; |
| 23 | + paths = [ emulator ]; |
| 24 | + |
| 25 | + postBuild = '' |
| 26 | + substitute ${./versions.json} $out/share/versions.json \ |
| 27 | + --replace-fail @shadps4@ $out/bin/shadps4 |
| 28 | +
|
| 29 | + substitute ${./qt_ui.ini} $out/share/qt_ui.ini \ |
| 30 | + --replace-fail @shadps4@ $out/bin/shadps4 |
| 31 | + ''; |
17 | 32 | }; |
18 | | -} |
| 33 | +in |
| 34 | +( |
| 35 | + if withGUI then |
| 36 | + stdenv.mkDerivation (finalAttrs: { |
| 37 | + pname = "shadps4-qt"; |
| 38 | + version = "0-unstable-2025-12-31"; |
| 39 | + |
| 40 | + inherit (emulator) |
| 41 | + postPatch |
| 42 | + cmakeFlags |
| 43 | + cmakeBuildType |
| 44 | + dontStrip |
| 45 | + runtimeDependencies |
| 46 | + ; |
| 47 | + |
| 48 | + src = fetchFromGitHub { |
| 49 | + inherit (emulator.src) owner leaveDotGit postFetch; |
| 50 | + repo = "shadps4-qtlauncher"; |
| 51 | + rev = "950f6264de2e4f1b53a82c759cd140a6d4c3a646"; |
| 52 | + hash = "sha256-8WSCtPdarosIXsvzmTZJThY54nWSU08mNkjdwLztAcQ="; |
| 53 | + fetchSubmodules = true; |
| 54 | + }; |
| 55 | + |
| 56 | + patches = [ |
| 57 | + (replaceVars ./qt-paths.patch { |
| 58 | + inherit shadps4; |
| 59 | + }) |
| 60 | + ]; |
| 61 | + |
| 62 | + nativeBuildInputs = (emulator.nativeBuildInputs or [ ]) ++ [ |
| 63 | + wrapQtAppsHook |
| 64 | + ]; |
| 65 | + |
| 66 | + buildInputs = (emulator.buildInputs or [ ]) ++ [ |
| 67 | + qtbase |
| 68 | + qttools |
| 69 | + qtmultimedia |
| 70 | + ]; |
| 71 | + |
| 72 | + installPhase = '' |
| 73 | + runHook preInstall |
| 74 | +
|
| 75 | + mkdir -p $out/bin |
| 76 | + ln -s ${shadps4}/bin/shadps4 $out/bin |
| 77 | +
|
| 78 | + install -Dm644 $src/.github/shadps4.png $out/share/icons/hicolor/512x512/apps/net.shadps4.shadPS4.png |
| 79 | + install -Dm644 -t $out/share/applications $src/dist/net.shadps4.shadps4-qtlauncher.desktop |
| 80 | + install -Dm644 -t $out/share/metainfo $src/dist/net.shadps4.shadps4-qtlauncher.metainfo.xml |
| 81 | +
|
| 82 | + install -Dm755 shadPS4QtLauncher $out/bin/shadps4-qt |
| 83 | +
|
| 84 | + runHook postInstall |
| 85 | + ''; |
| 86 | + |
| 87 | + meta = { |
| 88 | + inherit (emulator.meta) platforms; |
| 89 | + }; |
| 90 | + }) |
| 91 | + else |
| 92 | + emulator |
| 93 | +).overrideAttrs |
| 94 | + (oa: { |
| 95 | + meta = oa.meta // { |
| 96 | + description = "Early in development PS4 emulator"; |
| 97 | + homepage = |
| 98 | + if withGUI then |
| 99 | + "https://github.com/shadps4-emu/shadps4-qtlauncher" |
| 100 | + else |
| 101 | + "https://github.com/shadps4-emu/shadPS4"; |
| 102 | + license = lib.licenses.gpl2Plus; |
| 103 | + maintainers = with lib.maintainers; [ |
| 104 | + ryand56 |
| 105 | + liberodark |
| 106 | + ]; |
| 107 | + mainProgram = if withGUI then "shadps4-qt" else "shadps4"; |
| 108 | + }; |
| 109 | + }) |
0 commit comments