43 stdenv.mkDerivation (finalAttrs: {
47 src = fetchFromGitHub {
50 rev = finalAttrs.version;
51 hash = "sha256-0WTDhFt7GDzN4AK8U17iLkjeSMK+gOWZRq46HBTeO3w=";
55 (lib.cmakeBool "BUILD_CLIENT" buildClient)
56 (lib.cmakeBool "BUILD_SERVER" buildServer)
57 (lib.cmakeBool "BUILD_UNITTESTS" (finalAttrs.doCheck or false))
58 (lib.cmakeBool "ENABLE_PROMETHEUS" buildServer)
59 (lib.cmakeBool "USE_SDL2" useSDL2)
60 # Ensure we use system libraries
61 (lib.cmakeBool "ENABLE_SYSTEM_GMP" true)
62 (lib.cmakeBool "ENABLE_SYSTEM_JSONCPP" true)
63 # Updates are handled by nix anyway
64 (lib.cmakeBool "ENABLE_UPDATE_CHECKER" false)
65 # ...but make it clear that this is a nix package
66 (lib.cmakeFeature "VERSION_EXTRA" "NixOS")
68 # Remove when https://github.com/NixOS/nixpkgs/issues/144170 is fixed
69 (lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin")
70 (lib.cmakeFeature "CMAKE_INSTALL_DATADIR" "share")
71 (lib.cmakeFeature "CMAKE_INSTALL_DOCDIR" "share/doc/minetest")
72 (lib.cmakeFeature "CMAKE_INSTALL_MANDIR" "share/man")
73 (lib.cmakeFeature "CMAKE_INSTALL_LOCALEDIR" "share/locale")
94 ] ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform luajit) luajit
95 ++ lib.optionals stdenv.hostPlatform.isDarwin [
102 ] ++ lib.optionals buildClient [
109 ] ++ lib.optionals (buildClient && useSDL2) [
111 ] ++ lib.optionals (buildClient && !stdenv.hostPlatform.isDarwin && !useSDL2) [
114 ] ++ lib.optionals buildServer [
122 substituteInPlace src/filesys.cpp \
123 --replace-fail "/bin/rm" "${coreutils}/bin/rm"
124 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
125 sed -i '/pagezero_size/d;/fixup_bundle/d' src/CMakeLists.txt
128 postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
130 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
131 mkdir -p $out/Applications
132 mv $out/minetest.app $out/Applications
137 passthru.updateScript = gitUpdater {
138 allowedVersions = "\\.";
139 ignoredVersions = "-android$";
143 homepage = "https://minetest.net/";
144 description = "Infinite-world block sandbox game";
145 license = licenses.lgpl21Plus;
146 platforms = platforms.linux ++ platforms.darwin;
147 maintainers = with maintainers; [ pyrolagus fpletz fgaz ];
148 mainProgram = if buildClient then "minetest" else "minetestserver";