diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 640c23762d6..b9f71c2f825 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -147,6 +147,7 @@ ./services/desktops/telepathy.nix ./services/games/ghost-one.nix ./services/games/minecraft-server.nix + ./services/games/minetest-server.nix ./services/hardware/acpid.nix ./services/hardware/amd-hybrid-graphics.nix ./services/hardware/bluetooth.nix diff --git a/nixos/modules/services/games/minetest-server.nix b/nixos/modules/services/games/minetest-server.nix new file mode 100644 index 00000000000..996e313386f --- /dev/null +++ b/nixos/modules/services/games/minetest-server.nix @@ -0,0 +1,104 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.minetest-server; + flag = val: name: if val != null then "--${name} ${val} " else ""; + flags = [ + (flag cfg.gameId "gameid") + (flag cfg.world "world") + (flag cfg.configPath "config") + (flag cfg.logPath "logfile") + (flag cfg.port "port") + ]; +in +{ + options = { + services.minetest-server = { + enable = mkOption { + type = types.bool; + default = false; + description = "If enabled, starts a Minetest Server."; + }; + + gameId = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Id of the game to use. To list available games run + `minetestserver --gameid list`. + + If only one game exists, this option can be null. + ''; + }; + + world = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + Name of the world to use. To list available worlds run + `minetestserver --world list`. + + If only one world exists, this option can be null. + ''; + }; + + configPath = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + Path to the config to use. + + If set to null, the config of the running user will be used: + `~/.minetest/minetest.conf`. + ''; + }; + + logPath = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + Path to logfile for logging. + + If set to null, logging will be output to stdout which means + all output will be catched by systemd. + ''; + }; + + port = mkOption { + type = types.nullOr types.int; + default = null; + description = '' + Port number to bind to. + + If set to null, the default 30000 will be used. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + users.extraUsers.minetest = { + description = "Minetest Server Service user"; + home = "/var/lib/minetest"; + createHome = true; + uid = config.ids.uids.minetest; + }; + + systemd.services.minetest-server = { + description = "Minetest Server Service"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + + serviceConfig.Restart = "always"; + serviceConfig.User = "minetest"; + + script = '' + cd /var/lib/minetest + + exec ${pkgs.minetest}/bin/minetestserver ${concatStrings flags} + ''; + }; + }; +} diff --git a/pkgs/development/libraries/irrlicht/default.nix b/pkgs/development/libraries/irrlicht/default.nix index ac67c17218f..a682b3a6b82 100644 --- a/pkgs/development/libraries/irrlicht/default.nix +++ b/pkgs/development/libraries/irrlicht/default.nix @@ -11,7 +11,9 @@ stdenv.mkDerivation rec { sha256 = "0v31l3k0fzy7isdsx2sh0baaixzlml1m7vgz6cd0015d9f5n99vl"; }; - patchPhase = '' + patches = [ ./irrlicht-1.8.1-mesa-10.x.patch ]; + + postPatch = '' sed -i /stdcall-alias/d source/Irrlicht/Makefile ''; diff --git a/pkgs/development/libraries/irrlicht/irrlicht-1.8.1-mesa-10.x.patch b/pkgs/development/libraries/irrlicht/irrlicht-1.8.1-mesa-10.x.patch new file mode 100644 index 00000000000..e90ff36443a --- /dev/null +++ b/pkgs/development/libraries/irrlicht/irrlicht-1.8.1-mesa-10.x.patch @@ -0,0 +1,40 @@ +From 244d00280c1b082ca164f92337773e9e4e1a3898 Mon Sep 17 00:00:00 2001 +From: hiker +Date: Wed, 26 Feb 2014 11:13:03 +1100 +Subject: [PATCH] Applied patch from jpirie for fixing mesa 10 compilation + problems. + +--- irrlicht-1.8.1/source/Irrlicht/COpenGLExtensionHandler.h ++++ irrlicht-1.8.1/source/Irrlicht/COpenGLExtensionHandler.h +@@ -21,6 +21,7 @@ + #endif + #include + #if defined(_IRR_OPENGL_USE_EXTPOINTER_) ++ typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); + #include "glext.h" + #endif + #include "wglext.h" +@@ -35,6 +36,7 @@ + #endif + #include + #if defined(_IRR_OPENGL_USE_EXTPOINTER_) ++ typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); + #include "glext.h" + #endif + #elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_) +@@ -48,6 +50,7 @@ + #define NO_SDL_GLEXT + #include + #include ++ typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); + #include "glext.h" + #else + #if defined(_IRR_OPENGL_USE_EXTPOINTER_) +@@ -60,6 +63,7 @@ + #include + #include + #if defined(_IRR_OPENGL_USE_EXTPOINTER_) ++ typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); + #include "glext.h" + #undef GLX_ARB_get_proc_address // avoid problems with local glxext.h + #include "glxext.h" diff --git a/pkgs/games/minetest/default.nix b/pkgs/games/minetest/default.nix index f19596789ce..6c53bc3fdb3 100644 --- a/pkgs/games/minetest/default.nix +++ b/pkgs/games/minetest/default.nix @@ -7,10 +7,12 @@ let src = fetchgit { url = "https://github.com/celeron55/minetest.git"; rev = "ab06fca4bed26f3dc97d5e5cff437d075d7acff8"; + sha256 = "033gajwxgs8dqxb8684waaav28s0qd6cd4rlzfldwgdbkwam9cb1"; }; data = fetchgit { url = "https://github.com/celeron55/minetest_game.git"; rev = "3928eccf74af0288d12ffb14f8222fae479bc06b"; + sha256 = "1gw2267bnqwfpnm7iq014y1vkb1v3nhpg1dmg9vgm9z5yja2blif"; }; }; in stdenv.mkDerivation {