3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/games/dwarf-fortress/wrapper/default.nix
Nikolay Amiantov 92cda7a6bb dwarf-fortress: 0.40.24 -> 0.42.05, split derivations
This is a massive rework of the current dwarf_fortress package.
The main reason for rework is to split game, its libraries and wrappers,
enabling builds on Hydra and general maintainability.

dfhack, dwarf-fortress-unfuck, dwarf-fortress-original and dwarf-fortress
are now all separate derivations. All were updated to the latest versions
supporting DF 0.42.04 (some things taken from development branches):

dfhack: 20150927 -> 20160118
dwarf-fortress-unfuck: 0.40.24 -> 20160118
dwarf-fortress-original: 0.40.24 -> 0.42.05

dfhack got a patch for using more system libraries.

Wrapper scripts were also redone -- now they support DF_DIR variable (for
setting another data directory) and try to save more space by means of
symlinking. They now try to be more smart, updating those directories that were
not touched by user automatically.

All the new packages now reside in dwarf-fortress-packages. dwarf_fortress was
renamed into dwarf-fortress per our conventions, old name is deprecated. Also
duplicate dfhack derivation is removed.

Also drop dwarfFortress.enableDFHack config option; it can be re-added later
but now is deemed controversial.
2016-01-26 03:03:12 +03:00

48 lines
1.4 KiB
Nix

{ stdenv, lib, dwarf-fortress-original, substituteAll
, enableDFHack ? false, dfhack
}:
assert enableDFHack -> (dfhack.dfVersion == dwarf-fortress-original.dfVersion);
stdenv.mkDerivation rec {
name = "dwarf-fortress-${dwarf-fortress-original.dfVersion}";
runDF = ./dwarf-fortress.in;
runDFHack = ./dfhack.in;
dfInit = substituteAll {
name = "dwarf-fortress-init";
src = ./dwarf-fortress-init.in;
dwarfFortress = dwarf-fortress-original;
};
inherit dfhack;
df = dwarf-fortress-original;
buildCommand = ''
mkdir -p $out/bin
substitute $runDF $out/bin/dwarf-fortress \
--subst-var-by stdenv_shell ${stdenv.shell} \
--subst-var dfInit
chmod 755 $out/bin/dwarf-fortress
'' + lib.optionalString enableDFHack ''
mkdir -p $out/hack
substitute $dfhack/hack/symbols.xml $out/hack/symbols.xml \
--replace $(cat $df/full-hash-orig.md5) $(cat $df/full-hash-patched.md5)
substitute $runDFHack $out/bin/dfhack \
--subst-var-by stdenv_shell ${stdenv.shell} \
--subst-var dfInit \
--subst-var dfhack \
--subst-var-by dfhackWrapper $out
chmod 755 $out/bin/dfhack
'';
preferLocalBuild = true;
meta = {
description = "A single-player fantasy game with a randomly generated adventure world";
homepage = http://www.bay12games.com/dwarves;
maintainers = with lib.maintainers; [ a1russell robbinch roconnor the-kenny ];
};
}