Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 makeWrapper,
6 jdk,
7 jre,
8}:
9
10stdenv.mkDerivation {
11 pname = "remnants-of-the-precursors";
12 version = "1.04";
13
14 src = fetchFromGitHub {
15 owner = "rayfowler";
16 repo = "rotp-public";
17 rev = "e3726fc22c2c44316306c50c79779e3da1c4c140";
18 sha256 = "sha256-oMA8LRpBoBX7t4G+HuRz0a8g+UEwYO7Ya0Qq4j8AWec=";
19 };
20
21 nativeBuildInputs = [
22 jdk
23 makeWrapper
24 ];
25
26 # By default, the game tries to write to the java class path. If that fails
27 # (and it always does, since they are in the read-only nix store), it won't
28 # launch.
29 patches = [ ./0001-store-config-and-saves-in-XDG_CONFIG_HOME.patch ];
30
31 buildPhase = ''
32 runHook preBuild
33
34 javac -d "$out/share/" -sourcepath src src/rotp/Rotp.java
35
36 runHook postBuild
37 '';
38
39 installPhase = ''
40 runHook preInstall
41
42 # We need the assets, but don't want the source files.
43 find "src/rotp" -type f -name '*java' -exec rm "{}" \;
44 cp -r src/rotp/* "$out/share/rotp/"
45
46 mkdir -p $out/bin
47 makeWrapper ${jre}/bin/java $out/bin/rotp \
48 --add-flags "-cp $out/share rotp.Rotp"
49
50 runHook postInstall
51 '';
52
53 meta = with lib; {
54 description = ''Open-source modernization of the 1993 classic "Master of Orion", written in Java'';
55 homepage = "https://www.remnantsoftheprecursors.com/";
56
57 # See LICENSE file in source repo for more details.
58 license = with licenses; [
59 # All java files created by Ray Fowler:
60 gpl3Only
61
62 # All Java files in the src/rotp/apachemath folder:
63 asl20
64
65 # The /src/rotp/model/planet/PlanetHeightMap.java file:
66 #
67 # This file is a Java-rewrite of the "Planet Generator" code (originally in C)
68 # available from the following site:
69 #
70 # http://hjemmesider.diku.dk/~torbenm/Planet
71 #
72 # That page includes the following statement: "Both the program itself and
73 # maps created by the program are free for use, modification and reproduction,
74 # both privately and for commercial purposes, as long as this does not limit
75 # what other people may do with the program and the images they produce with
76 # the program"
77 {
78 free = true;
79 url = "http://hjemmesider.diku.dk/~torbenm/Planet";
80 }
81
82 # All image files are copyright by Peter Penev.
83 #
84 # All sound files are copyright by Remi Agullo.
85 #
86 # Various *.txt files that contain a license notice are copyright by Jeff Colucci. This
87 # includes English text and any foreign language translations.
88 #
89 # The manual.pdf file is copyright by Tom Chick. This includes any foreign language
90 # translations of the manual contained in this repository
91 cc-by-nc-nd-40
92 ];
93
94 maintainers = with maintainers; [ jtrees ];
95 platforms = [ "x86_64-linux" ];
96 };
97}