forked from Erisia/builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
313 lines (273 loc) · 9.09 KB
/
default.nix
File metadata and controls
313 lines (273 loc) · 9.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
with import <nixpkgs> {};
with stdenv;
with import ./lib/lib.nix;
let
serverId = "erisia";
serverName = "erisia-12";
serverDesc = "Erisia #12: Vivat Apparatus";
# lib.nix actually assumes 1.7.10 in a lot of places. This isn't plumbed through.
forgeMajor = "1.7.10";
forgeMinor = "10.13.4.1566";
packUrlBase = "https://madoka.brage.info/";
in
rec {
bevos = mkBasePack {
src = fetchzip {
# url = https://madoka.brage.info/baughn/BevosK.zip;
# sha256 = "0m9mlqhshzxj26a2gjrh6ag9387ff3qz3v7r52gknxrn4qgyiz42";
url = https://madoka.brage.info/baughn/BevosM.zip;
sha256 = "0qw9h4iai51ky7jd7kn6ijwvrcnm1xj8yrhzxs7qyi3c2infqd8x";
stripRoot = false;
};
# This lets you set options for mods in the base back.
# Same way as for mods added to it, below.
modConfig = {
fastcraft = {
required = false;
# side = "CLIENT";
};
};
};
# TODO: Don't forget the BoP biome mismatch.
# This is where we add mods that weren't part of Bevos.
mods = bevos.mods // {
# TODO: The below has a hell of a lot of not-using-the-version-option.
# Because it never works.
# It should be possible to make use of the perl version-number parser to fix that.
# These mod(s) override mods that exist in Bevo's pack, so the attribute name
# actually matters. For everything else, it pretty much doesn't.
# Okay, so it's just growthcraft.
growthcraft = fetchCurse {
name = "growthcraft-community-edition";
target = "Growthcraft 2.5.0 Complete";
};
# Server-side mods:
dynmap = fetchCurse {
name = "dynmapforge";
target = "Dynmap v2.2 for MC 1.7.10 (Forge 10.13.2)";
side = "SERVER";
};
eirairc = fetchCurse {
name = "eirairc";
target = "eirairc-mc1.7.10-2.9.402.jar";
side = "SERVER";
};
# Client-side:
WhatsThisPack = fetchCurse {
name = "wtp-whats-this-pack";
target = "WTP-1.7.10-1.0.29.1.jar";
side = "CLIENT";
};
# Both-sided:
ImmibisCore = mkMod {
name = "ImmibisCore-59.1.4";
src = fetchurl {
url = http://immibis.com/mcmoddl/files/immibis-core-59.1.4.jar;
md5 = "14dbc89ce3d361541234ac183270b5a1";
};
};
DimensionalAnchors = mkMod {
name = "DimensionalAnchors-59.0.3";
src = fetchurl {
url = http://immibis.com/mcmoddl/files/dimensional-anchor-59.0.3.jar;
md5 = "65669c1fab43ae1d3ef41a659fdd530c";
};
};
ElectricalAge = mkMod {
name = "ElectricalAge-51.1";
src = fetchurl {
url = https://madoka.brage.info/baughn/ElectricalAge-51.1.jar;
sha256 = "cc5a0c18a52c700b56be8e1d4beb0b97bbf585fa76306a93273da777f39f2dc3";
};
};
PrometheusIntegration = mkMod {
name = "PrometheusIntegration-1.0.1";
src = fetchurl {
url = https://madoka.brage.info/baughn/prometheus-integration-1.0.1.jar;
sha256 = "afb91f49cb033a8d734ee4711caf872c31d7f7edb537e3303679bbdb92364f52";
};
};
Agricraft = fetchCurse {
name = "AgriCraft";
version = "1.5.0";
};
Automagy = fetchCurse {
name = "Automagy";
target = "v0.28.2";
};
BiomesOPlenty = fetchCurse {
name = "biomes-o-plenty";
target = "BiomesOPlenty-1.7.10-2.1.0.1889-universal.jar";
};
Farseek = fetchCurse { # streams dependency
name = "Farseek";
target = "Farseek-1.0.11.jar";
};
Flatsigns = fetchCurse {
name = "flatsigns";
target = "FlatSigns-1.7.10-universal-2.1.0.19.jar";
};
ForbiddenMagic = fetchCurse {
name = "forbidden-magic";
target = "Forbidden Magic-1.7.10-0.574.jar";
};
IguanasTinkerTweaks = fetchCurse {
name = "iguanas-tinker-tweaks";
target = "IguanaTinkerTweaks-1.7.10-2.1.6.jar";
};
MagicBees = fetchCurse {
name = "magic-bees";
target = "magicbees-1.7.10-2.4.3.jar";
};
Streams = fetchCurse {
name = "streams";
target = "Streams-0.2.jar";
};
RTG = fetchCurse {
name = "realistic-terrain-generation";
target = "RTG-1.7.10-0.7.0";
};
TcNodeTracker = fetchCurse {
name = "thaumcraft-node-tracker";
target = "tcnodetracker-1.7.10-1.1.2.jar";
};
ThaumicEnergistics = fetchCurse {
name = "thaumic-energistics";
target = "Thaumic Energistics 1.0.0.1";
};
ThaumicHorizons = fetchCurse {
name = "thaumic-horizons";
target = "thaumichorizons-1.7.10-1.1.9.jar";
};
ThaumicTinkerer = fetchCurse {
name = "thaumic-tinkerer";
target = "Thaumic Tinkerer 164";
};
TravellersGear = fetchCurse {
name = "travellers-gear";
target = "Traveller's Gear v1.16.6";
};
Witchery = fetchCurse {
name = "witchery";
version = "0.24.1";
};
WitchingGadgets = fetchCurse {
name = "witching-gadgets";
target = "Witching Gadgets v1.1.10";
};
Ztones = fetchCurse {
name = "ztones";
target = "Ztones-1.7.10-2.2.1.jar";
};
# Reika's mods below. Beware.
DragonAPI = fetchCurse {
name = "dragonapi";
target = "DragonAPI 1.7.10 V12e.jar";
};
RotaryCraft = fetchCurse {
name = "rotarycraft";
target = "RotaryCraft 1.7.10 V12e.jar";
};
};
server = mkServer {
name = serverName;
mods = mods;
forge = fetchForge {
major = forgeMajor; minor = forgeMinor;
sha1 = "4d2xzm7w6xwk09q7sbcsbnsalc09xp0v";
};
# These are applied in order. In case of overwrites nothing is deleted.
# They're also copied to the client, after applying the below patches.
extraDirs = [
(bevos.getDir "config")
(bevos.getDir "scripts")
(bevos.getDir "libraries")
(bevos.getDir "mods/resources")
# This is, of course, inside the git repository. Being last, any files you
# put here override files in Bevos' zips.
./base
];
# These are applied after everything else.
# And in order, if it matters.
# TODO: Write something that understands what it's doing.
configPatches = [
''sed -i StorageDrawers.cfg -e s/B:invertShift=false/B:invertShift=true/''
# I hope no-one was using this. Reconsider if Bevos updates their own version.
# Why did we need 2.5.0 again? ...I assume there was a good reason.
''rm growthcraft/cellar/*.json''
];
};
#####################################################
## Nothing below here is particularly relevant ##
## ##
## Stop reading. ##
## ##
## I mean it. You don't want to read what's below. ##
## ##
#####################################################
## On your head be it. ##
#####################################################
# A quick hack to get MCUpdater running on NixOS.
mcupdater = with xlibs; mkDerivation {
name = "mcupdater-3";
src = fetchurl {
url = https://madoka.brage.info/MCU-Bootstrap.jar;
sha256 = "1rm287bf4m0lnxc7yk5ahrmbbqnrp3ywq7ig5wm3wc5zpsjpfp0n";
};
phases = "installPhase";
installPhase = ''
mkdir -p $out/bin $out/share/mcupdater/
cp $src $out/share/mcupdater/mcupdater.jar
cat > $out/bin/mcupdater << EOF
#!${stdenv.shell}
# wrapper for mcupdater/minecraft
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${libX11}/lib/:${libXext}/lib/:${libXcursor}/lib/:${libXrandr}/lib/:${libXxf86vm}/lib/:${mesa}/lib/:${openal}/lib/:${pulseaudioLight}/lib
java -jar $out/share/mcupdater/mcupdater.jar
EOF
chmod +x $out/bin/mcupdater
'';
};
# TODO: Move most of this into the lib. Or something.
ServerPack = let
baseParams = {
serverId = serverId;
serverDesc = serverDesc;
forgeUrl = "https://files.mcupdater.com/example/forge.php?mc=${forgeMajor}&forge=${forgeMinor}";
mods = lib.mapAttrs (name: mod: let details = import mod; in {
modId = name;
url = packUrlBase + "mods/" + builtins.baseNameOf mod.outPath;
modpath = "mods/" + details.modpath;
side = mod.side;
required = mod.required;
modtype = mod.modtype;
md5 = details.md5;
}) mods;
configs = lib.mapAttrs (name: md5: {
configId = name;
url = packUrlBase + "configs/" + name + ".zip";
inherit md5;
}) (import server.baseMinecraft);
};
in
mkDerivation (rec {
name = "ServerPack";
buildInputs = [ libxslt ];
stylesheet = ./lib/serverpack.xsl;
modList = builtins.attrValues mods;
configs = server.baseMinecraft;
params = writeTextFile {
name = "params.xml";
text = builtins.toXML (baseParams // {
revision = builtins.hashString "sha256" (builtins.toXML baseParams);
});
};
builder = mkBuilder ''
mkdir -p $out/{mods,configs}
xsltproc ${stylesheet} $params > $out/ServerPack.xml
for mod in $modList; do
ln -s $mod/mods/*.jar $out/mods/$(basename $mod)
done
ln -s $configs/*.zip $out/configs/
'';
});
}