Skip to content

Commit

Permalink
games/gog: Switch everything to gogUnpackHook
Browse files Browse the repository at this point in the history
For Albion, Settlers 2 and World of Xeen we need to explicitly add
gogUnpackHook, because for those the derivation containing the game data
is not created via our buildGame wrapper.

Everything else is just done by removing unpackCmd and unzip from the
package arguments. One exception is Thimbleweed Park, which relied on
custom path for unzip in order to get the desktop icon, but with our now
hook, we get that icon now in xdg-icon.png with a flat directory
structure.

I've tested this by building all the games from GOG that we have
packaged here. However, I didn't test whether every single one actually
runs.

Signed-off-by: aszlig <[email protected]>
  • Loading branch information
aszlig committed Jul 30, 2018
1 parent e5afeaa commit a8e4069
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 56 deletions.
18 changes: 7 additions & 11 deletions pkgs/games/gog/albion/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ stdenv, lib, buildSandbox, fetchGog, fetchzip, innoextract, SDL2, SDL2_mixer
, bchunk, p7zip, alsaLib, writeText, makeWrapper, libGL
{ stdenv, lib, buildSandbox, fetchGog, gogUnpackHook, fetchzip
, SDL2, SDL2_mixer, bchunk, p7zip, alsaLib, writeText, makeWrapper, libGL

# For static recompilation
, fetchFromGitHub, scons, judy, python, nasm, autoreconfHook
Expand Down Expand Up @@ -97,16 +97,12 @@ let

outputs = [ "out" "dev" ];

nativeBuildInputs = [ innoextract ];
nativeBuildInputs = [ gogUnpackHook ];
innoExtractOnly = [ "game.gog" "game.ins" "MAIN.EXE" "SETUP.INI" ];
innoExtractKeepCase = true;

phases = [ "unpackPhase" "patchPhase" "installPhase" ];
unpackCmd = toString [
"innoextract"
"--include" "game.gog"
"--include" "game.ins"
"--include" "MAIN.EXE"
"--include" "SETUP.INI"
"-m" "\"$curSrc\""
];

patchPhase = ''
sed -i -e '
s,^SOURCE_PATH=.*,SOURCE_PATH=C:\\,
Expand Down
4 changes: 1 addition & 3 deletions pkgs/games/gog/dungeons3.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ buildUnity, fetchGog, unzip, mono }:
{ buildUnity, fetchGog, mono }:

buildUnity {
name = "dungeons3";
Expand All @@ -13,6 +13,4 @@ buildUnity {
};

buildInputs = [ mono ];

unpackCmd = "${unzip}/bin/unzip -qq \"$curSrc\" 'data/noarch/game/*' || :";
}
4 changes: 1 addition & 3 deletions pkgs/games/gog/overload.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ buildUnity, fetchGog, unzip }:
{ buildUnity, fetchGog }:

buildUnity {
name = "overload";
Expand All @@ -11,6 +11,4 @@ buildUnity {
downloadName = "en3installer0";
sha256 = "1r42ll6k2xif405rp85gn3sbhacrhf1kkpqx2ahp8j5f9alscdxm";
};

unpackCmd = "${unzip}/bin/unzip -qq \"$curSrc\" 'data/noarch/game/*' || :";
}
4 changes: 1 addition & 3 deletions pkgs/games/gog/party-hard.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ buildUnity, fetchGog, unzip }:
{ buildUnity, fetchGog }:

buildUnity {
name = "party-hard";
Expand All @@ -11,6 +11,4 @@ buildUnity {
downloadName = "en3installer2";
sha256 = "00sb76w0v4b2izfwx1kr53frrgg8rg5d0qgpj8z3xq8frnv1fmi4";
};

unpackCmd = "${unzip}/bin/unzip -qq \"$curSrc\" 'data/noarch/game/*' || :";
}
4 changes: 1 addition & 3 deletions pkgs/games/gog/satellite-reign.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ buildUnity, fetchGog, unzip }:
{ buildUnity, fetchGog }:

buildUnity {
name = "satellite-reign";
Expand All @@ -12,7 +12,5 @@ buildUnity {
sha256 = "0wpkpqrcli2772g6l9yab38vbjh1by4cbpa397fqvhny247qdz5k";
};

unpackCmd = "${unzip}/bin/unzip -qq \"$curSrc\" 'data/noarch/game/*' || :";

sandbox.paths.required = [ "$XDG_DATA_HOME/SatelliteReign" ];
}
12 changes: 4 additions & 8 deletions pkgs/games/gog/settlers2.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, lib, buildSandbox, fetchGog, innoextract, bchunk, p7zip
{ stdenv, lib, buildSandbox, fetchGog, gogUnpackHook, bchunk, p7zip

, fetchFromGitHub, cmake, gettext, boost, miniupnpc, bzip2
, SDL, SDL_mixer, libpulseaudio, alsaLib, libGL, lua5_2
Expand All @@ -15,14 +15,10 @@ let
sha256 = "19c88h972ydfpdbay61lz6pi4gnlm2lq5dcya5im9mmlin2nvyr7";
};

unpackCmd = toString [
"innoextract"
"--include" "/app/DATA"
"--include" "/app/GFX"
"-m" "\"$curSrc\""
];
nativeBuildInputs = [ gogUnpackHook ];
innoExtractOnly = [ "/app/DATA" "/app/GFX" ];
innoExtractKeepCase = true;

nativeBuildInputs = [ innoextract ];
phases = [ "unpackPhase" "patchPhase" "installPhase" ];

installPhase = ''
Expand Down
5 changes: 1 addition & 4 deletions pkgs/games/gog/stardew-valley.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, buildGame, fetchGog, unzip, makeWrapper
{ lib, stdenv, buildGame, fetchGog, makeWrapper
, mono50, SDL2, libGL, openal

, beta ? false
Expand All @@ -20,9 +20,6 @@ buildGame rec {
sha256 = "199xf008cxm6ywb4d8c3dz0h7iiv9d0ka5k93gq0jqj3ga3fjn3i";
});

unpackCmd = lib.optionalString (!beta)
"${unzip}/bin/unzip -qq \"$curSrc\" 'data/noarch/game/*' || :";

nativeBuildInputs = [ makeWrapper ];

buildPhase = let
Expand Down
13 changes: 5 additions & 8 deletions pkgs/games/gog/thimbleweed-park.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, buildGame, fetchGog, unzip, libGL, libudev
{ lib, buildGame, fetchGog, libGL, libudev

, ransomeUnbeeped ? true
}:
Expand All @@ -17,8 +17,6 @@ buildGame rec {
sha256 = "1cfll73qazm9nz40n963qvankqkznfjai9g88kgw6xcl40y8jrqn";
});

unpackCmd = "${unzip}/bin/unzip -qq \"$curSrc\" 'data/noarch/*' || :";

buildInputs = [ libGL ];

runtimeDependencies = [ libudev ];
Expand All @@ -38,18 +36,17 @@ buildGame rec {
}
EOF
patchelf --add-needed "$out/libexec/thimbleweed-park/preload.so" \
game/ThimbleweedPark
ThimbleweedPark
'';

installPhase = ''
install -vD game/ThimbleweedPark "$out/bin/thimbleweed-park"
install -vD ThimbleweedPark "$out/bin/thimbleweed-park"
install -vD preload.so "$out/libexec/thimbleweed-park/preload.so"
for i in game/*.ggpack[0-9]*; do
for i in *.ggpack[0-9]*; do
install -vD -m 0644 "$i" "$out/share/thimbleweed-park/$(basename "$i")"
done
install -vD -m 0644 support/icon.png \
"$out/share/icons/thimbleweed-park.png"
install -vD -m 0644 xdg-icon.png "$out/share/icons/thimbleweed-park.png"
mkdir -p "$out/share/applications"
cat > "$out/share/applications/thimbleweed-park.desktop" <<EOF
Expand Down
4 changes: 1 addition & 3 deletions pkgs/games/gog/war-for-the-overworld.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ buildUnity, fetchGog, unzip, mono, monogamePatcher }:
{ buildUnity, fetchGog, mono, monogamePatcher }:

buildUnity {
name = "war-for-the-overworld";
Expand All @@ -12,8 +12,6 @@ buildUnity {
sha256 = "07yj9clf3hmy7z67ck9sqf3gnrazx5rzifg91jas77z774vwdg8k";
};

unpackCmd = "${unzip}/bin/unzip -qq \"$curSrc\" 'data/noarch/game/*' || :";

nativeBuildInputs = [ mono monogamePatcher ];

# The game tries to write stuff to its dataPath and it's even more
Expand Down
4 changes: 1 addition & 3 deletions pkgs/games/gog/wizard-of-legend.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ buildUnity, fetchGog, unzip }:
{ buildUnity, fetchGog }:

buildUnity {
name = "wizard-of-legend";
Expand All @@ -11,6 +11,4 @@ buildUnity {
downloadName = "en3installer0";
sha256 = "192fhway7ij5f4fh0vb1204f3yg3fxz08fvqlg03gskjs9krcbcz";
};

unpackCmd = "${unzip}/bin/unzip -qq \"$curSrc\" 'data/noarch/game/*' || :";
}
10 changes: 3 additions & 7 deletions pkgs/games/gog/xeen.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, buildSandbox, fetchGog, innoextract, bchunk, p7zip
{ lib, stdenv, buildSandbox, fetchGog, gogUnpackHook, bchunk, p7zip
, scummvm, fetchFromGitHub
, runCommand, xvfb_run

Expand All @@ -20,12 +20,8 @@ let
sha256 = "0jv9k5rcapqlk61pawa5l4m34iwllx8j6cfz69gl092h04fvfqki";
};

unpackCmd = toString [
"${innoextract}/bin/innoextract"
"--include" "app/game1.gog"
"--include" "app/music"
"-L" "-m" "\"$curSrc\""
];
nativeBuildInputs = [ gogUnpackHook ];
innoExtractOnly = [ "app/game1.gog" "app/music" ];

patchPhase = ''
cat > game1.inst <<EOF
Expand Down

0 comments on commit a8e4069

Please sign in to comment.