nixpkgs/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
Herwig Hochleitner d29cee773c dwarf-fortress: 0.43.05 -> 0.44.02
dwarf-therapist: 37.0.0-Hello71 -> 39.0.0
dfhack: 0.43.05-r1 -> 0.44.02-alpha1
cla-theme: 43.05-v23 -> 44.01-v24
phoebus-theme: 43.05c -> 44.02a

There is a new maintained repository for
dwarf-therapist: http://www.bay12forums.com/smf/index.php?topic=168411

dfhack is still in alpha, so make backups, if you use it.

cc @the-kenny @abbradar
2017-12-11 20:41:38 +01:00

34 lines
1.0 KiB
Nix

{ stdenv, symlinkJoin, lib, dwarf-therapist-original, dwarf-fortress-original, makeWrapper }:
let
df = dwarf-fortress-original;
dt = dwarf-therapist-original;
platformSlug = if stdenv.targetPlatform.is32bit then
"linux32" else "linux64";
inifile = "linux/v0.${df.baseVersion}.${df.patchVersion}_${platformSlug}.ini";
dfHashFile = "${df}/hash.md5";
in symlinkJoin {
name = "dwarf-therapist-${dt.version}";
paths = [ dt ];
buildInputs = [ makeWrapper ];
postBuild = ''
# DwarfTherapist assumes it's run in $out/share/dwarftherapist and
# therefore uses many relative paths.
wrapProgram $out/bin/DwarfTherapist \
--run "cd $out/share/dwarftherapist"
rm -rf $out/share/dwarftherapist/memory_layouts/linux
mkdir -p $out/share/dwarftherapist/memory_layouts/linux
origmd5=$(cat "${dfHashFile}.orig" | cut -c1-8)
patchedmd5=$(cat "${dfHashFile}" | cut -c1-8)
substitute \
${dt.layouts}/${inifile} \
$out/share/dwarftherapist/memory_layouts/${inifile} \
--replace "$origmd5" "$patchedmd5"
'';
}