Merge pull request #34611 from peterhoeg/p/descent

descent 1 & 2: use assets from gog.com with the dxx-rebirth project

Changed files
+136 -1
pkgs
build-support
setup-hooks
games
dxx-rebirth
tools
filesystems
file-rename
top-level
+11
pkgs/build-support/setup-hooks/gog-unpack.sh
···
+
unpackPhase="unpackGog"
+
+
unpackGog() {
+
runHook preUnpackGog
+
+
innoextract --silent --extract --exclude-temp "${src}"
+
+
find . -depth -print -execdir rename -f 'y/A-Z/a-z/' '{}' \;
+
+
runHook postUnpackGog
+
}
+55
pkgs/games/dxx-rebirth/assets.nix
···
+
{ stdenv, requireFile, gogUnpackHook }:
+
+
let
+
generic = ver: source: let
+
pname = "descent${toString ver}";
+
in stdenv.mkDerivation rec {
+
name = "${pname}-assets-${version}";
+
version = "2.0.0.7";
+
+
src = requireFile rec {
+
name = "setup_descent12_${version}.exe";
+
sha256 = "1r1drbfda6czg21f9qqiiwgnkpszxgmcn5bafp5ljddh34swkn3f";
+
message = ''
+
While the Descent ${toString ver} game engine is free, the game assets are not.
+
+
Please purchase the game on gog.com and download the Windows installer.
+
+
Once you have downloaded the file, please use the following command and re-run the
+
installation:
+
+
nix-prefetch-url file://\$PWD/${name}
+
'';
+
};
+
+
nativeBuildInputs = [ gogUnpackHook ];
+
+
dontBuild = true;
+
dontFixup = true;
+
+
installPhase = ''
+
runHook preInstall
+
+
mkdir -p $out/share/{games/${pname},doc/${pname}/examples}
+
pushd "app/${source}"
+
mv dosbox*.conf $out/share/doc/${pname}/examples
+
mv *.txt *.pdf $out/share/doc/${pname}
+
cp -r * $out/share/games/descent${toString ver}
+
popd
+
+
runHook postInstall
+
'';
+
+
meta = with stdenv.lib; {
+
description = "Descent ${toString ver} assets from GOG";
+
homepage = http://www.dxx-rebirth.com/;
+
license = licenses.unfree;
+
maintainers = with maintainers; [ peterhoeg ];
+
hydraPlatforms = [];
+
};
+
};
+
+
in {
+
descent1-assets = generic 1 "descent";
+
descent2-assets = generic 2 "descent 2";
+
}
+30
pkgs/games/dxx-rebirth/full.nix
···
+
{ stdenv, makeWrapper
+
, dxx-rebirth, descent1-assets, descent2-assets }:
+
+
let
+
generic = ver: assets: stdenv.mkDerivation rec {
+
name = "d${toString ver}x-rebirth-full-${assets.version}";
+
+
nativeBuildInputs = [ makeWrapper ];
+
+
buildCommand = ''
+
mkdir -p $out/bin
+
+
makeWrapper ${dxx-rebirth}/bin/d${toString ver}x-rebirth $out/bin/descent${toString ver} \
+
--add-flags "-hogdir ${assets}/share/games/descent${toString ver}"
+
'';
+
+
meta = with stdenv.lib; {
+
description = "Descent ${toString ver} using the DXX-Rebirth project engine and game assets from GOG";
+
homepage = http://www.dxx-rebirth.com/;
+
license = with licenses; [ free unfree ];
+
maintainers = with maintainers; [ peterhoeg ];
+
platforms = with platforms; linux;
+
hydraPlatforms = [];
+
};
+
};
+
+
in {
+
d1x-rebirth-full = generic 1 descent1-assets;
+
d2x-rebirth-full = generic 2 descent2-assets;
+
}
+24
pkgs/tools/filesystems/file-rename/default.nix
···
+
{ stdenv, fetchurl, perlPackages, makeWrapper }:
+
+
perlPackages.buildPerlPackage rec {
+
name = "File-Rename-0.20";
+
+
src = fetchurl {
+
url = "mirror://cpan/authors/id/R/RM/RMBARKER/${name}.tar.gz";
+
sha256 = "1cf6xx2hiy1xalp35fh8g73j67r0w0g66jpcbc6971x9jbm7bvjy";
+
};
+
+
nativeBuildInputs = [ makeWrapper ];
+
+
postInstall = ''
+
wrapProgram $out/bin/rename \
+
--prefix PERL5LIB : $out/lib/perl5/site_perl
+
'';
+
+
meta = with stdenv.lib; {
+
description = "Perl extension for renaming multiple files";
+
homepage = http://search.cpan.org/~rmbarker;
+
license = licenses.artistic1;
+
maintainer = with maintainers; [ peterhoeg ];
+
};
+
}
+16 -1
pkgs/top-level/all-packages.nix
···
{ substitutions = { gnu_config = gnu-config;}; }
../build-support/setup-hooks/update-autotools-gnu-config-scripts.sh;
+
gogUnpackHook = makeSetupHook {
+
name = "gog-unpack-hook";
+
deps = [ innoextract file-rename ]; }
+
../build-support/setup-hooks/gog-unpack.sh;
+
buildEnv = callPackage ../build-support/buildenv { }; # not actually a package
buildFHSUserEnv = callPackage ../build-support/build-fhs-userenv { };
···
nologin = shadow;
npm2nix = nodePackages.npm2nix;
+
+
file-rename = callPackage ../tools/filesystems/file-rename { };
kea = callPackage ../tools/networking/kea {
boost = boost165;
···
physfs = physfs_2;
+
# these are here for compatibility
d1x_rebirth = dxx-rebirth;
+
d2x_rebirth = dxx-rebirth;
-
d2x_rebirth = dxx-rebirth;
+
inherit (callPackages ../games/dxx-rebirth/assets.nix { })
+
descent1-assets
+
descent2-assets;
+
+
inherit (callPackages ../games/dxx-rebirth/full.nix { })
+
d1x-rebirth-full
+
d2x-rebirth-full;
easyrpg-player = callPackage ../games/easyrpg-player { };