1{
2 stdenvNoCC,
3 lib,
4 fetchurl,
5 unzip,
6 dfVersion,
7}:
8
9let
10 inherit (lib)
11 getAttr
12 hasAttr
13 licenses
14 maintainers
15 platforms
16 ;
17
18 twbt-releases = {
19 "0.44.12" = {
20 twbtRelease = "6.54";
21 hash = "sha256-cKomZmTLHab9K8k0pZsB2uMf3D5/SVhy2GRusLdp7oE=";
22 prerelease = false;
23 };
24 "0.47.05" = {
25 twbtRelease = "6.xx";
26 dfhackRelease = "0.47.05-r8";
27 hash = "sha256-qiNs6iMAUNGiq0kpXqEs4u4Wcrjf6/qA/dzBe947Trc=";
28 prerelease = false;
29 };
30 };
31
32 release =
33 if hasAttr dfVersion twbt-releases then
34 getAttr dfVersion twbt-releases
35 else
36 throw "[TWBT] Unsupported Dwarf Fortress version: ${dfVersion}";
37in
38
39stdenvNoCC.mkDerivation rec {
40 pname = "twbt";
41 version = release.twbtRelease;
42
43 src = fetchurl {
44 url =
45 if version == "6.xx" then
46 "https://github.com/thurin/df-twbt/releases/download/${release.dfhackRelease}/twbt-${version}-linux64-${release.dfhackRelease}.zip"
47 else
48 "https://github.com/mifki/df-twbt/releases/download/v${version}/twbt-${version}-linux.zip";
49 inherit (release) hash;
50 };
51
52 sourceRoot = ".";
53
54 outputs = [
55 "lib"
56 "art"
57 "out"
58 ];
59
60 nativeBuildInputs = [ unzip ];
61
62 installPhase = ''
63 mkdir -p $lib/hack/{plugins,lua} $art/data/art
64 cp -a */twbt.plug.so $lib/hack/plugins/
65 cp -a *.lua $lib/hack/lua/
66 cp -a *.png $art/data/art/
67 '';
68
69 passthru = {
70 inherit dfVersion;
71 };
72
73 meta = {
74 description = "Plugin for Dwarf Fortress / DFHack that improves various aspects of the game interface";
75 maintainers = with maintainers; [
76 Baughn
77 numinit
78 ];
79 license = licenses.mit;
80 platforms = platforms.linux;
81 homepage = "https://github.com/mifki/df-twbt";
82 };
83}