about summary refs log tree commit diff
path: root/pkgs/games/minetest/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games/minetest/default.nix')
-rw-r--r--pkgs/games/minetest/default.nix15
1 files changed, 10 insertions, 5 deletions
diff --git a/pkgs/games/minetest/default.nix b/pkgs/games/minetest/default.nix
index 3a49b5b90f44..de566217b1ba 100644
--- a/pkgs/games/minetest/default.nix
+++ b/pkgs/games/minetest/default.nix
@@ -54,6 +54,7 @@ stdenv.mkDerivation (finalAttrs: {
   cmakeFlags = [
     (lib.cmakeBool "BUILD_CLIENT" buildClient)
     (lib.cmakeBool "BUILD_SERVER" buildServer)
+    (lib.cmakeBool "BUILD_UNITTESTS" (finalAttrs.doCheck or false))
     (lib.cmakeBool "ENABLE_PROMETHEUS" buildServer)
     (lib.cmakeBool "USE_SDL2" useSDL2)
     # Ensure we use system libraries
@@ -91,7 +92,7 @@ stdenv.mkDerivation (finalAttrs: {
     gmp
     libspatialindex
   ] ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform luajit) luajit
-    ++ lib.optionals stdenv.hostPlatform.isDarwin [
+  ++ lib.optionals stdenv.hostPlatform.isDarwin [
     libiconv
     OpenGL
     OpenAL
@@ -118,18 +119,21 @@ stdenv.mkDerivation (finalAttrs: {
   ];
 
   postPatch = ''
-    substituteInPlace src/filesys.cpp --replace "/bin/rm" "${coreutils}/bin/rm"
-  '' + lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/filesys.cpp \
+      --replace-fail "/bin/rm" "${coreutils}/bin/rm"
+  '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
     sed -i '/pagezero_size/d;/fixup_bundle/d' src/CMakeLists.txt
   '';
 
-  postInstall = lib.optionalString stdenv.isLinux ''
+  postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
     patchShebangs $out
-  '' + lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
     mkdir -p $out/Applications
     mv $out/minetest.app $out/Applications
   '';
 
+  doCheck = true;
+
   passthru.updateScript = gitUpdater {
     allowedVersions = "\\.";
     ignoredVersions = "-android$";
@@ -141,5 +145,6 @@ stdenv.mkDerivation (finalAttrs: {
     license = licenses.lgpl21Plus;
     platforms = platforms.linux ++ platforms.darwin;
     maintainers = with maintainers; [ pyrolagus fpletz fgaz ];
+    mainProgram = if buildClient then "minetest" else "minetestserver";
   };
 })