1 { lib, stdenv, fetchFromGitHub, cmake, xz, boost, libdevil, zlib, p7zip
2 , openal, libvorbis, glew, freetype, xorg, SDL2, libGLU, libGL
3 , asciidoc, docbook_xsl, docbook_xsl_ns, curl, makeWrapper
4 , jdk ? null, python ? null, systemd, libunwind, which, minizip
5 , withAI ? true # support for AI Interfaces and Skirmish AIs
8 stdenv.mkDerivation rec {
10 version = "105.0.1-${buildId}-g${shortRev}";
11 # usually the latest in https://github.com/spring/spring/commits/maintenance
12 rev = "8581792eac65e07cbed182ccb1e90424ce3bd8fc";
13 shortRev = builtins.substring 0 7 rev;
16 # taken from https://github.com/spring/spring/commits/maintenance
17 src = fetchFromGitHub {
21 sha256 = "05lvd8grqmv7vl8rrx02rhl0qhmm58dyi6s78b64j3fkia4sfj1r";
22 fetchSubmodules = true;
25 # The cmake included module correcly finds nix's glew, however
26 # it has to be the bundled FindGLEW for headless or dedicated builds
28 substituteInPlace ./rts/build/cmake/FindAsciiDoc.cmake \
29 --replace "PATHS /usr /usr/share /usr/local /usr/local/share" "PATHS ${docbook_xsl}"\
30 --replace "xsl/docbook/manpages" "share/xml/docbook-xsl/manpages"
31 substituteInPlace ./rts/Rendering/GL/myGL.cpp \
32 --replace "static constexpr const GLubyte* qcriProcName" "static const GLubyte* qcriProcName"
34 rm rts/build/cmake/FindGLEW.cmake
36 echo "${version} maintenance" > VERSION
39 cmakeFlags = ["-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON"
40 "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON"
41 "-DPREFER_STATIC_LIBS:BOOL=OFF"];
43 nativeBuildInputs = [ cmake makeWrapper docbook_xsl docbook_xsl_ns asciidoc ];
44 buildInputs = [ xz boost libdevil zlib p7zip openal libvorbis freetype SDL2
45 xorg.libX11 xorg.libXcursor libGLU libGL glew curl
46 systemd libunwind which minizip ]
47 ++ lib.optional withAI jdk
48 ++ lib.optional withAI python;
50 NIX_CFLAGS_COMPILE = "-fpermissive"; # GL header minor incompatibility
53 wrapProgram "$out/bin/spring" \
54 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc systemd ]}"
58 homepage = "https://springrts.com/";
59 description = "A powerful real-time strategy (RTS) game engine";
60 license = licenses.gpl2;
61 maintainers = with maintainers; [ qknight domenkozar sorki ];
62 platforms = platforms.linux;