15 # revisions are taken from https://github.com/GrimKriegor/TES3MP-deploy
18 # raknet could also be split into dev and lib outputs
19 raknet = stdenv.mkDerivation {
21 version = "unstable-2018-07-14";
23 src = fetchFromGitHub {
27 # https://github.com/GrimKriegor/TES3MP-deploy/blob/d2a4a5d3acb64b16d9b8ca85906780aeea8d311b/tes3mp-deploy.sh#L589
28 rev = "4eeeaad2f6c11aeb82070df35169694b4fb7b04b";
29 sha256 = "0p0li9l1i5lcliswm5w9jql0zff9i6fwhiq0bl130m4i7vpr4cr3";
32 nativeBuildInputs = [ cmake ];
35 install -Dm555 lib/libRakNetLibStatic.a $out/lib/libRakNetLibStatic.a
39 coreScripts = stdenv.mkDerivation {
40 pname = "corescripts";
41 version = "unstable-2020-07-27";
43 src = fetchFromGitHub {
46 # usually latest in stable branch (e.g. 0.7.1)
47 rev = "3c2d31595344db586d8585db0ef1fc0da89898a0";
48 sha256 = "sha256-m/pt2Et58HOMc1xqllGf4hjPLXNcc14+X0h84ouZDeg=";
52 dir=$out/share/openmw-tes3mp
54 cp -r $src $dir/CoreScripts
58 # build an unwrapped version so we don't have to rebuild it all over again in
59 # case the scripts or wrapper scripts change.
60 unwrapped = openmw.overrideAttrs (oldAttrs: rec {
61 pname = "openmw-tes3mp-unwrapped";
62 version = "unstable-2020-08-07";
64 src = fetchFromGitHub {
66 repo = "openmw-tes3mp";
67 # usually latest in stable branch (e.g. 0.7.1)
68 rev = "ce5df6d18546e37aac9746d99c00d27a7f34b00d";
69 sha256 = "sha256-xLslShNA6rVFl9kt6BNGDpSYMpO25jBTCteLJoSTXdg=";
72 nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ makeWrapper ];
74 buildInputs = (builtins.map (x: if x.pname or "" == "bullet" then bullet else x) oldAttrs.buildInputs)
77 cmakeFlags = oldAttrs.cmakeFlags ++ [
79 "-DRakNet_INCLUDES=${raknet.src}/include"
80 "-DRakNet_LIBRARY_RELEASE=${raknet}/lib/libRakNetLibStatic.a"
81 "-DRakNet_LIBRARY_DEBUG=${raknet}/lib/libRakNetLibStatic.a"
85 substituteInPlace components/process/processinvoker.cpp \
86 --replace "\"./\"" "\"$out/bin/\""
89 # https://github.com/TES3MP/openmw-tes3mp/issues/552
90 patches = oldAttrs.patches ++ [ ./tes3mp.patch ];
92 NIX_CFLAGS_COMPILE = "-fpermissive";
95 substituteInPlace files/version.in \
96 --subst-var-by OPENMW_VERSION_COMMITHASH ${src.rev}
99 # move everything that we wrap out of the way
101 mkdir -p $out/libexec
102 mv $out/bin/tes3mp-* $out/libexec
106 description = "Multiplayer for TES3:Morrowind based on OpenMW";
107 homepage = "https://tes3mp.com/";
108 license = licenses.gpl3Only;
109 maintainers = with maintainers; [ peterhoeg ];
110 platforms = [ "x86_64-linux" "i686-linux" ];
115 cfgFile = (formats.ini { }).generate "tes3mp-server.cfg" {
116 Plugins.home = "${coreScripts}/share/openmw-tes3mp/CoreScripts";
121 name = "openmw-tes3mp-${unwrapped.version}";
122 inherit (unwrapped) version meta;
124 nativeBuildInputs = [ makeWrapper ];
126 paths = [ unwrapped ];
128 # crudini --merge will create the file if it doesn't exist
132 dir=\''${XDG_CONFIG_HOME:-\$HOME/.config}/openmw
134 makeWrapper ${unwrapped}/libexec/tes3mp-browser $out/bin/tes3mp-browser \
137 makeWrapper ${unwrapped}/libexec/tes3mp-server $out/bin/tes3mp-server \
138 --run "mkdir -p $dir" \
139 --run "${crudini}/bin/crudini --merge $dir/${cfgFile.name} < ${cfgFile}" \