33 url = "https://svn.code.sf.net/p/supertuxkart/code/stk-assets";
35 sha256 = "1a84j3psl4cxzkn5ynakpjill7i2f9ki2p729bpmbrvg8fki95aa";
39 # List of bundled libraries in stk-code/lib to keep
40 # Those are the libraries that cannot be replaced
41 # with system packages.
43 # Bullet 2.87 is incompatible (bullet 2.79 needed whereas 2.87 is packaged)
44 # The api changed in a lot of classes, too much work to adapt
46 # Upstream Libenet doesn't yet support IPv6,
47 # So we will use the bundled libenet which
48 # has been fixed to support it.
50 # Internal library of STK, nothing to do about it
52 # Internal library of STK, nothing to do about it
56 # This irrlicht is bundled with cmake
57 # whereas upstream irrlicht still uses
58 # archaic Makefiles, too complicated to switch to.
60 # Not packaged to this date
62 # Not packaged to this date
64 # Not packaged to this date
66 # Not packaged to this date (needed on Darwin)
70 stdenv.mkDerivation rec {
72 pname = "supertuxkart";
75 src = fetchFromGitHub {
76 owner = "supertuxkart";
79 hash = "sha256-gqdaVvgNfCN40ZO/9y8+vTeIJPSq6udKxYZ/MAi4ZMM=";
83 # Deletes all bundled libs in stk-code/lib except those
84 # That couldn't be replaced with system packages
85 find lib -maxdepth 1 -type d | egrep -v "^lib$|${(lib.concatStringsSep "|" bundledLibraries)}" | xargs -n1 -L1 -r -I{} rm -rf {}
87 # Allow building with system-installed wiiuse on Darwin
88 substituteInPlace CMakeLists.txt \
89 --replace 'NOT (APPLE OR HAIKU)) AND USE_SYSTEM_WIIUSE' 'NOT (HAIKU)) AND USE_SYSTEM_WIIUSE'
115 ++ lib.optional (stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isLinux) libopenglrecorder
116 ++ lib.optional stdenv.hostPlatform.isLinux openal
117 ++ lib.optionals stdenv.hostPlatform.isDarwin [
127 if (stdenv.hostPlatform.isWindows || stdenv.hostPlatform.isLinux) then "ON" else "OFF"
129 "-DUSE_SYSTEM_ANGELSCRIPT=ON"
131 "-DUSE_SYSTEM_WIIUSE=ON"
132 "-DOpenGL_GL_PREFERENCE=GLVND"
136 # GCC 13: error: 'snprintf' was not declared in this scope
138 # GCC 13: error: 'runtime_error' is not a member of 'std'
142 # Extract binary from built app bundle
143 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
145 mv $out/{supertuxkart.app/Contents/MacOS,bin}/supertuxkart
146 rm -rf $out/supertuxkart.app
149 # Obtain the assets directly from the fetched store path, to avoid duplicating assets across multiple engine builds
151 wrapProgram $out/bin/supertuxkart \
152 --set-default SUPERTUXKART_ASSETS_DIR "${assets}" \
153 --set-default SUPERTUXKART_DATADIR "$out/share/supertuxkart" \
157 description = "Free 3D kart racing game";
158 mainProgram = "supertuxkart";
160 SuperTuxKart is a Free 3D kart racing game, with many tracks,
161 characters and items for you to try, similar in spirit to Mario
164 homepage = "https://supertuxkart.net/";
165 license = licenses.gpl2Plus;
166 maintainers = with maintainers; [
170 platforms = with platforms; unix;
171 changelog = "https://github.com/supertuxkart/stk-code/blob/${version}/CHANGELOG.md";