lol
1{ lib, stdenv
2, fetchsvn
3# jdk8 is needed for building, but the game runs on newer jres as well
4, jdk8
5, jre
6, ant
7, makeWrapper
8, makeDesktopItem
9, copyDesktopItems
10, nixosTests
11}:
12
13let
14 desktopItem = makeDesktopItem {
15 name = "domination";
16 desktopName = "Domination";
17 exec = "domination";
18 icon = "domination";
19 };
20 editorDesktopItem = makeDesktopItem {
21 name = "domination-map-editor";
22 desktopName = "Domination Map Editor";
23 exec = "domination-map-editor";
24 icon = "domination";
25 };
26
27in stdenv.mkDerivation {
28 pname = "domination";
29 version = "1.2.9";
30
31 # The .zip releases do not contain the build.xml file
32 src = fetchsvn {
33 url = "https://svn.code.sf.net/p/domination/code/Domination";
34 # There are no tags in the repository.
35 # Look for commits like "new version x.y.z info on website"
36 # or "website update for x.y.z".
37 rev = "2470";
38 hash = "sha256-ghq7EGg++mTOzA3ASzXhk97fzy5/n9vyaRzxp12X3/4=";
39 };
40
41 nativeBuildInputs = [
42 jdk8
43 ant
44 makeWrapper
45 copyDesktopItems
46 ];
47
48 buildPhase = ''
49 runHook preBuild
50 cd swingUI
51 ant
52 runHook postBuild
53 '';
54
55 desktopItems = [
56 desktopItem
57 editorDesktopItem
58 ];
59
60 installPhase = ''
61 runHook preInstall
62 # Remove unnecessary files and launchers (they'd need to be wrapped anyway)
63 rm -r \
64 build/game/src.zip \
65 build/game/*.sh \
66 build/game/*.cmd \
67 build/game/*.exe \
68 build/game/*.app
69
70 mkdir -p $out/share/domination
71 cp -r build/game/* $out/share/domination/
72
73 # Reimplement the two launchers mentioned in Unix_shortcutSpec.xml with makeWrapper
74 mkdir -p $out/bin
75 makeWrapper ${jre}/bin/java $out/bin/domination \
76 --chdir "$out/share/domination" \
77 --add-flags "-jar $out/share/domination/Domination.jar"
78 makeWrapper ${jre}/bin/java $out/bin/domination-map-editor \
79 --chdir "$out/share/domination" \
80 --add-flags "-cp $out/share/domination/Domination.jar net.yura.domination.ui.swinggui.SwingGUIFrame"
81
82 install -Dm644 build/game/resources/icon.png $out/share/pixmaps/domination.png
83 runHook postInstall
84 '';
85
86 passthru.tests = {
87 domination-starts = nixosTests.domination;
88 };
89
90 meta = with lib; {
91 homepage = "https://domination.sourceforge.net/";
92 downloadPage = "https://domination.sourceforge.net/download.shtml";
93 description = "A game that is a bit like the board game Risk or RisiKo";
94 longDescription = ''
95 Domination is a game that is a bit like the well known board game of Risk
96 or RisiKo. It has many game options and includes many maps.
97 It includes a map editor, a simple map format, multiplayer network play,
98 single player, hotseat, 5 user interfaces and many more features.
99 '';
100 sourceProvenance = with sourceTypes; [
101 fromSource
102 binaryBytecode # source bundles dependencies as jars
103 ];
104 license = licenses.gpl3;
105 maintainers = with maintainers; [ fgaz ];
106 platforms = platforms.all;
107 };
108}