git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #34611 from peterhoeg/p/descent

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

commit8016f9b4c90a99d366fe7d3666254c180f3dc834 authorPeter Hoeg <peter@hoeg.com> dateMon 12 Feb 2018, 22:31 (9 years ago) parent8a60770e88284b
5 files changed+136−1
pkgs/build-support/setup-hooks/gog-unpack.sh+11 pkgs/games/dxx-rebirth/assets.nix+55 pkgs/games/dxx-rebirth/full.nix+30 pkgs/tools/filesystems/file-rename/default.nix+24 pkgs/top-level/all-packages.nix+16−1
pkgs/build-support/setup-hooks/gog-unpack.shnew file+11
@@ -0,0 +1,11 @@
1+unpackPhase="unpackGog"
2+
3+unpackGog() {
4+ runHook preUnpackGog
5+
6+ innoextract --silent --extract --exclude-temp "${src}"
7+
8+ find . -depth -print -execdir rename -f 'y/A-Z/a-z/' '{}' \;
9+
10+ runHook postUnpackGog
11+}
pkgs/games/dxx-rebirth/assets.nixnew file+55
@@ -0,0 +1,55 @@
1+{ stdenv, requireFile, gogUnpackHook }:
2+
3+let
4+ generic = ver: source: let
5+ pname = "descent${toString ver}";
6+ in stdenv.mkDerivation rec {
7+ name = "${pname}-assets-${version}";
8+ version = "2.0.0.7";
9+
10+ src = requireFile rec {
11+ name = "setup_descent12_${version}.exe";
12+ sha256 = "1r1drbfda6czg21f9qqiiwgnkpszxgmcn5bafp5ljddh34swkn3f";
13+ message = ''
14+ While the Descent ${toString ver} game engine is free, the game assets are not.
15+
16+ Please purchase the game on gog.com and download the Windows installer.
17+
18+ Once you have downloaded the file, please use the following command and re-run the
19+ installation:
20+
21+ nix-prefetch-url file://\$PWD/${name}
22+ '';
23+ };
24+
25+ nativeBuildInputs = [ gogUnpackHook ];
26+
27+ dontBuild = true;
28+ dontFixup = true;
29+
30+ installPhase = ''
31+ runHook preInstall
32+
33+ mkdir -p $out/share/{games/${pname},doc/${pname}/examples}
34+ pushd "app/${source}"
35+ mv dosbox*.conf $out/share/doc/${pname}/examples
36+ mv *.txt *.pdf $out/share/doc/${pname}
37+ cp -r * $out/share/games/descent${toString ver}
38+ popd
39+
40+ runHook postInstall
41+ '';
42+
43+ meta = with stdenv.lib; {
44+ description = "Descent ${toString ver} assets from GOG";
45+ homepage = http://www.dxx-rebirth.com/;
46+ license = licenses.unfree;
47+ maintainers = with maintainers; [ peterhoeg ];
48+ hydraPlatforms = [];
49+ };
50+ };
51+
52+in {
53+ descent1-assets = generic 1 "descent";
54+ descent2-assets = generic 2 "descent 2";
55+}
pkgs/games/dxx-rebirth/full.nixnew file+30
@@ -0,0 +1,30 @@
1+{ stdenv, makeWrapper
2+, dxx-rebirth, descent1-assets, descent2-assets }:
3+
4+let
5+ generic = ver: assets: stdenv.mkDerivation rec {
6+ name = "d${toString ver}x-rebirth-full-${assets.version}";
7+
8+ nativeBuildInputs = [ makeWrapper ];
9+
10+ buildCommand = ''
11+ mkdir -p $out/bin
12+
13+ makeWrapper ${dxx-rebirth}/bin/d${toString ver}x-rebirth $out/bin/descent${toString ver} \
14+ --add-flags "-hogdir ${assets}/share/games/descent${toString ver}"
15+ '';
16+
17+ meta = with stdenv.lib; {
18+ description = "Descent ${toString ver} using the DXX-Rebirth project engine and game assets from GOG";
19+ homepage = http://www.dxx-rebirth.com/;
20+ license = with licenses; [ free unfree ];
21+ maintainers = with maintainers; [ peterhoeg ];
22+ platforms = with platforms; linux;
23+ hydraPlatforms = [];
24+ };
25+ };
26+
27+in {
28+ d1x-rebirth-full = generic 1 descent1-assets;
29+ d2x-rebirth-full = generic 2 descent2-assets;
30+}
pkgs/tools/filesystems/file-rename/default.nixnew file+24
@@ -0,0 +1,24 @@
1+{ stdenv, fetchurl, perlPackages, makeWrapper }:
2+
3+perlPackages.buildPerlPackage rec {
4+ name = "File-Rename-0.20";
5+
6+ src = fetchurl {
7+ url = "mirror://cpan/authors/id/R/RM/RMBARKER/${name}.tar.gz";
8+ sha256 = "1cf6xx2hiy1xalp35fh8g73j67r0w0g66jpcbc6971x9jbm7bvjy";
9+ };
10+
11+ nativeBuildInputs = [ makeWrapper ];
12+
13+ postInstall = ''
14+ wrapProgram $out/bin/rename \
15+ --prefix PERL5LIB : $out/lib/perl5/site_perl
16+ '';
17+
18+ meta = with stdenv.lib; {
19+ description = "Perl extension for renaming multiple files";
20+ homepage = http://search.cpan.org/~rmbarker;
21+ license = licenses.artistic1;
22+ maintainer = with maintainers; [ peterhoeg ];
23+ };
24+}
pkgs/top-level/all-packages.nix+16−1
@@ -96,6 +96,11 @@ with pkgs;
9696 { substitutions = { gnu_config = gnu-config;}; }
9797 ../build-support/setup-hooks/update-autotools-gnu-config-scripts.sh;
9898
99+ gogUnpackHook = makeSetupHook {
100+ name = "gog-unpack-hook";
101+ deps = [ innoextract file-rename ]; }
102+ ../build-support/setup-hooks/gog-unpack.sh;
103+
99104 buildEnv = callPackage ../build-support/buildenv { }; # not actually a package
100105
101106 buildFHSUserEnv = callPackage ../build-support/build-fhs-userenv { };
@@ -3236,6 +3241,8 @@ with pkgs;
32363241
32373242 npm2nix = nodePackages.npm2nix;
32383243
3244+ file-rename = callPackage ../tools/filesystems/file-rename { };
3245+
32393246 kea = callPackage ../tools/networking/kea {
32403247 boost = boost165;
32413248 };
@@ -18384,10 +18391,18 @@ with pkgs;
1838418391 physfs = physfs_2;
1838518392 };
1838618393
18394+ # these are here for compatibility
1838718395 d1x_rebirth = dxx-rebirth;
18388−
1838918396 d2x_rebirth = dxx-rebirth;
1839018397
18398+ inherit (callPackages ../games/dxx-rebirth/assets.nix { })
18399+ descent1-assets
18400+ descent2-assets;
18401+
18402+ inherit (callPackages ../games/dxx-rebirth/full.nix { })
18403+ d1x-rebirth-full
18404+ d2x-rebirth-full;
18405+
1839118406 easyrpg-player = callPackage ../games/easyrpg-player { };
1839218407
1839318408 eboard = callPackage ../games/eboard { };