blob: 8af98d258146617cfe4d80b60f27c98c5a0ad31b [file] [log] [blame]
Skyler Turner038082f2022-02-08 18:34:01 +00001final: prev: let
Skyler Turner9bce7122022-02-08 19:21:08 +00002 version = "135";
3
4 jdk = prev.adoptopenjdk-hotspot-bin-15;
Skyler Turner038082f2022-02-08 18:34:01 +00005
Skyler Turner9cc9f092022-02-08 18:36:02 +00006 Mindustry = final.fetchFromGitHub {
Skyler Turner038082f2022-02-08 18:34:01 +00007 owner = "Anuken";
8 repo = "Mindustry";
9 rev = "v${version}";
10 sha256 = "URmjmfzQAVVl6erbh3+FVFdN7vGTNwYKPtcrwtt9vkg=";
11 };
Skyler Turner9cc9f092022-02-08 18:36:02 +000012 Arc = final.fetchFromGitHub {
Skyler Turner038082f2022-02-08 18:34:01 +000013 owner = "Anuken";
14 repo = "Arc";
Skyler Turner9bce7122022-02-08 19:21:08 +000015 rev = "v${version}";
Skyler Turner038082f2022-02-08 18:34:01 +000016 sha256 = "pUUak5P9t4RmSdT+/oH/8oo6l7rjIN08XDJ06TcUn8I=";
17 };
Skyler Turner9cc9f092022-02-08 18:36:02 +000018 soloud = final.fetchFromGitHub {
Skyler Turner038082f2022-02-08 18:34:01 +000019 owner = "Anuken";
20 repo = "soloud";
21 # this is never pinned in upstream, see https://github.com/Anuken/Arc/issues/39
22 rev = "b33dfc5178fcb2613ee68136f4a4869cadc0b06a";
23 sha256 = "1vf68i3pnsixch37285ib7afkwmlrc05v783395jsdjzj9i67lj3";
24 };
25
26 unpackPhase = ''
27 cp -r ${Mindustry} Mindustry
28 cp -r ${Arc} Arc
29 chmod -R u+w -- Mindustry Arc
30 cp ${prev.stb.src}/stb_image.h Arc/arc-core/csrc/
31 cp -r ${soloud} Arc/arc-core/csrc/soloud
32 chmod -R u+w -- Arc
33 '';
Skyler Turner9bce7122022-02-08 19:21:08 +000034
35 gradle_6 = (prev.gradleGen.override (old: { java = jdk; })).gradle_6_9;
36
37 enableClient = prev.enableClient or true;
38 enableServer = prev.enableServer or true;
Skyler Turner038082f2022-02-08 18:34:01 +000039in {
40 mindustry-alpha-wayland = prev.mindustry-wayland.overrideAttrs (old: {
41 inherit version unpackPhase;
Skyler Turner9bce7122022-02-08 19:21:08 +000042
43 nativeBuildInputs = [
44 prev.pkg-config
45 gradle_6
46 prev.makeWrapper
47 jdk
48 ] ++ prev.lib.optionals enableClient [
49 prev.ant
50 prev.copyDesktopItems
51 ];
52
53 meta.lib.broken = false;
54
55 installPhase = with prev.lib; ''
56 runHook preInstall
57 '' + optionalString enableClient ''
58 install -Dm644 desktop/build/libs/Mindustry.jar $out/share/mindustry.jar
59 mkdir -p $out/bin
60 makeWrapper ${jdk}/bin/java $out/bin/mindustry \
61 --add-flags "-jar $out/share/mindustry.jar"
62 install -Dm644 core/assets/icons/icon_64.png $out/share/icons/hicolor/64x64/apps/mindustry.png
63 '' + optionalString enableServer ''
64 install -Dm644 server/build/libs/server-release.jar $out/share/mindustry-server.jar
65 mkdir -p $out/bin
66 makeWrapper ${jdk}/bin/java $out/bin/mindustry-server \
67 --add-flags "-jar $out/share/mindustry-server.jar"
68 '' + ''
69 runHook postInstall
70 '';
Skyler Turnerb1702332022-02-08 18:34:23 +000071 });
Skyler Turner038082f2022-02-08 18:34:01 +000072}