nixpkgs-suyu/pkgs/games/dwarf-fortress/game.nix

53 lines
1.6 KiB
Nix
Raw Normal View History

{ stdenv, lib, fetchurl
, SDL, dwarf-fortress-unfuck
}:
let
baseVersion = "42";
patchVersion = "05";
dfVersion = "0.${baseVersion}.${patchVersion}";
libpath = lib.makeLibraryPath [ stdenv.cc.cc stdenv.glibc dwarf-fortress-unfuck SDL ];
in
assert dwarf-fortress-unfuck.dfVersion == dfVersion;
stdenv.mkDerivation {
name = "dwarf-fortress-original-${dfVersion}";
src = fetchurl {
url = "http://www.bay12games.com/dwarves/df_${baseVersion}_${patchVersion}_linux.tar.bz2";
sha256 = "0g7r0v2lsqj9ryxh12q8yrk96bgs00rf2ncw228cwwqgmps3xcws";
};
installPhase = ''
mkdir -p $out
cp -r * $out
rm $out/libs/lib*
# Store the original hash
orig_hash=$(md5sum $out/libs/Dwarf_Fortress | awk '{ print $1 }')
echo $orig_hash | cut -c1-8 > $out/hash.md5.orig # for dwarf-therapist
echo $orig_hash > $out/full-hash-orig.md5 # for dfhack
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath "${libpath}" \
$out/libs/Dwarf_Fortress
# Store new hash
patched_hash=$(md5sum $out/libs/Dwarf_Fortress | awk '{ print $1 }')
echo $patched_hash | cut -c1-8 > $out/hash.md5.patched # for dwarf-therapist
echo $patched_hash > $out/full-hash-patched.md5 # for dfhack
'';
passthru = { inherit baseVersion patchVersion dfVersion; };
meta = {
description = "A single-player fantasy game with a randomly generated adventure world";
homepage = http://www.bay12games.com/dwarves;
license = lib.licenses.unfreeRedistributable;
maintainers = with lib.maintainers; [ a1russell robbinch roconnor the-kenny abbradar ];
};
}