summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-09-12 22:13:02 +0200
committerGitHub <noreply@github.com>2021-09-12 22:13:02 +0200
commite4b50b4821027c85fd7d2f559adad18a637e1a3a (patch)
tree00ff9572f3ea5e9c71b311a4a55a70ed5887cb1a
parentd5540fa18f9bc7e914e9b48d462c5cddfc7fb013 (diff)
parent7221585f89c72078b070d14e4f00f439db0b92fb (diff)
Merge pull request #66415 from ToxicFrog/crossfire
-rw-r--r--nixos/modules/module-list.nix2
-rw-r--r--nixos/modules/services/games/crossfire-server.nix177
-rw-r--r--nixos/modules/services/games/deliantra-server.nix170
-rw-r--r--pkgs/development/libraries/blitz/default.nix67
-rw-r--r--pkgs/games/crossfire/crossfire-arch.nix27
-rw-r--r--pkgs/games/crossfire/crossfire-client.nix32
-rw-r--r--pkgs/games/crossfire/crossfire-maps.nix27
-rw-r--r--pkgs/games/crossfire/crossfire-server.nix37
-rw-r--r--pkgs/games/crossfire/default.nix28
-rw-r--r--pkgs/games/deliantra/0001-abs.patch17
-rw-r--r--pkgs/games/deliantra/0002-datadir.patch11
-rw-r--r--pkgs/games/deliantra/default.nix10
-rw-r--r--pkgs/games/deliantra/deliantra-arch.nix25
-rw-r--r--pkgs/games/deliantra/deliantra-data.nix21
-rw-r--r--pkgs/games/deliantra/deliantra-maps.nix25
-rw-r--r--pkgs/games/deliantra/deliantra-server.nix48
-rw-r--r--pkgs/top-level/all-packages.nix8
-rw-r--r--pkgs/top-level/perl-packages.nix113
18 files changed, 845 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 76cc4411baba..fed212c0332c 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -383,6 +383,8 @@
./services/display-managers/greetd.nix
./services/editors/emacs.nix
./services/editors/infinoted.nix
+ ./services/games/crossfire-server.nix
+ ./services/games/deliantra-server.nix
./services/games/factorio.nix
./services/games/freeciv.nix
./services/games/minecraft-server.nix
diff --git a/nixos/modules/services/games/crossfire-server.nix b/nixos/modules/services/games/crossfire-server.nix
new file mode 100644
index 000000000000..974aea0cd671
--- /dev/null
+++ b/nixos/modules/services/games/crossfire-server.nix
@@ -0,0 +1,177 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.crossfire-server;
+ serverPort = 13327;
+in {
+ options.services.crossfire-server = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If enabled, the Crossfire game server will be started at boot.
+ '';
+ };
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.crossfire-server;
+ defaultText = "pkgs.crossfire-server";
+ description = ''
+ The package to use for the Crossfire server (and map/arch data, if you
+ don't change dataDir).
+ '';
+ };
+
+ dataDir = mkOption {
+ type = types.str;
+ default = "${cfg.package}/share/crossfire";
+ defaultText = "\${config.services.crossfire.package}/share/crossfire";
+ description = ''
+ Where to load readonly data from -- maps, archetypes, treasure tables,
+ and the like. If you plan to edit the data on the live server (rather
+ than overlaying the crossfire-maps and crossfire-arch packages and
+ nixos-rebuilding), point this somewhere read-write and copy the data
+ there before starting the server.
+ '';
+ };
+
+ stateDir = mkOption {
+ type = types.str;
+ default = "/var/lib/crossfire";
+ description = ''
+ Where to store runtime data (save files, persistent items, etc).
+
+ If left at the default, this will be automatically created on server
+ startup if it does not already exist. If changed, it is the admin's
+ responsibility to make sure that the directory exists and is writeable
+ by the `crossfire` user.
+ '';
+ };
+
+ openFirewall = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to open ports in the firewall for the server.
+ '';
+ };
+
+ configFiles = mkOption {
+ type = types.attrsOf types.str;
+ description = ''
+ Text to append to the corresponding configuration files. Note that the
+ files given in the example are *not* the complete set of files available
+ to customize; look in /etc/crossfire after enabling the server to see
+ the available files, and read the comments in each file for detailed
+ documentation on the format and what settings are available.
+
+ Note that the motd, rules, and news files, if configured here, will
+ overwrite the example files that come with the server, rather than being
+ appended to them as the other configuration files are.
+ '';
+ example = literalExample ''
+ dm_file = '''
+ admin:secret_password:localhost
+ jane:xyzzy:*
+ ''';
+ ban_file = '''
+ # Bob is a jerk
+ bob@*
+ # So is everyone on 192.168.86.255/24
+ *@192.168.86.
+ ''';
+ metaserver2 = '''
+ metaserver2_notification on
+ localhostname crossfire.example.net
+ ''';
+ motd = "Welcome to CrossFire!";
+ news = "No news yet.";
+ rules = "Don't be a jerk.";
+ settings = '''
+ # be nicer to newbies and harsher to experienced players
+ balanced_stat_loss true
+ # don't let players pick up and use admin-created items
+ real_wiz false
+ ''';
+ '';
+ default = {};
+ };
+ };
+
+ config = mkIf cfg.enable {
+ users.users.crossfire = {
+ description = "Crossfire server daemon user";
+ home = cfg.stateDir;
+ createHome = false;
+ isSystemUser = true;
+ group = "crossfire";
+ };
+ users.groups.crossfire = {};
+
+ # Merge the cfg.configFiles setting with the default files shipped with
+ # Crossfire.
+ # For most files this consists of reading ${crossfire}/etc/crossfire/${name}
+ # and appending the user setting to it; the motd, news, and rules are handled
+ # specially, with user-provided values completely replacing the original.
+ environment.etc = lib.attrsets.mapAttrs'
+ (name: value: lib.attrsets.nameValuePair "crossfire/${name}" {
+ mode = "0644";
+ text =
+ (optionalString (!elem name ["motd" "news" "rules"])
+ (fileContents "${cfg.package}/etc/crossfire/${name}"))
+ + "\n${value}";
+ }) ({
+ ban_file = "";
+ dm_file = "";
+ exp_table = "";
+ forbid = "";
+ metaserver2 = "";
+ motd = (fileContents "${cfg.package}/etc/crossfire/motd");
+ news = (fileContents "${cfg.package}/etc/crossfire/news");
+ rules = (fileContents "${cfg.package}/etc/crossfire/rules");
+ settings = "";
+ stat_bonus = "";
+ } // cfg.configFiles);
+
+ systemd.services.crossfire-server = {
+ description = "Crossfire Server Daemon";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+
+ serviceConfig = mkMerge [
+ {
+ ExecStart = "${cfg.package}/bin/crossfire-server -conf /etc/crossfire -local '${cfg.stateDir}' -data '${cfg.dataDir}'";
+ Restart = "always";
+ User = "crossfire";
+ Group = "crossfire";
+ WorkingDirectory = cfg.stateDir;
+ }
+ (mkIf (cfg.stateDir == "/var/lib/crossfire") {
+ StateDirectory = "crossfire";
+ })
+ ];
+
+ # The crossfire server needs access to a bunch of files at runtime that
+ # are not created automatically at server startup; they're meant to be
+ # installed in $PREFIX/var/crossfire by `make install`. And those files
+ # need to be writeable, so we can't just point at the ones in the nix
+ # store. Instead we take the approach of copying them out of the store
+ # on first run. If `bookarch` already exists, we assume the rest of the
+ # files do as well, and copy nothing -- otherwise we risk ovewriting
+ # server state information every time the server is upgraded.
+ preStart = ''
+ if [ ! -e "${cfg.stateDir}"/bookarch ]; then
+ ${pkgs.rsync}/bin/rsync -a --chmod=u=rwX,go=rX \
+ "${cfg.package}/var/crossfire/" "${cfg.stateDir}/"
+ fi
+ '';
+ };
+
+ networking.firewall = mkIf cfg.openFirewall {
+ allowedTCPPorts = [ serverPort ];
+ };
+ };
+}
diff --git a/nixos/modules/services/games/deliantra-server.nix b/nixos/modules/services/games/deliantra-server.nix
new file mode 100644
index 000000000000..36bf60417626
--- /dev/null
+++ b/nixos/modules/services/games/deliantra-server.nix
@@ -0,0 +1,170 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.deliantra-server;
+ serverPort = 13327;
+in {
+ options.services.deliantra-server = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If enabled, the Deliantra game server will be started at boot.
+ '';
+ };
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.deliantra-server;
+ defaultText = "pkgs.deliantra-server";
+ description = ''
+ The package to use for the Deliantra server (and map/arch data, if you
+ don't change dataDir).
+ '';
+ };
+
+ dataDir = mkOption {
+ type = types.str;
+ default = "${pkgs.deliantra-data}";
+ defaultText = "\${pkgs.deliantra-data}";
+ description = ''
+ Where to store readonly data (maps, archetypes, sprites, etc).
+ Note that if you plan to use the live map editor (rather than editing
+ the maps offline and then nixos-rebuilding), THIS MUST BE WRITEABLE --
+ copy the deliantra-data someplace writeable (say,
+ /var/lib/deliantra/data) and update this option accordingly.
+ '';
+ };
+
+ stateDir = mkOption {
+ type = types.str;
+ default = "/var/lib/deliantra";
+ description = ''
+ Where to store runtime data (save files, persistent items, etc).
+
+ If left at the default, this will be automatically created on server
+ startup if it does not already exist. If changed, it is the admin's
+ responsibility to make sure that the directory exists and is writeable
+ by the `crossfire` user.
+ '';
+ };
+
+ openFirewall = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to open ports in the firewall for the server.
+ '';
+ };
+
+ configFiles = mkOption {
+ type = types.attrsOf types.str;
+ description = ''
+ Contents of the server configuration files. These will be appended to
+ the example configurations the server comes with and overwrite any
+ default settings defined therein.
+
+ The example here is not comprehensive. See the files in
+ /etc/deliantra-server after enabling this module for full documentation.
+ '';
+ example = literalExample ''
+ dm_file = '''
+ admin:secret_password:localhost
+ jane:xyzzy:*
+ ''';
+ motd = "Welcome to Deliantra!";
+ settings = '''
+ # Settings for game mechanics.
+ stat_loss_on_death true
+ armor_max_enchant 7
+ ''';
+ config = '''
+ # Settings for the server daemon.
+ hiscore_url https://deliantra.example.net/scores/
+ max_map_reset 86400
+ ''';
+ '';
+ default = {
+ motd = "";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ users.users.deliantra = {
+ description = "Deliantra server daemon user";
+ home = cfg.stateDir;
+ createHome = false;
+ isSystemUser = true;
+ group = "deliantra";
+ };
+ users.groups.deliantra = {};
+
+ # Merge the cfg.configFiles setting with the default files shipped with
+ # Deliantra.
+ # For most files this consists of reading
+ # ${deliantra}/etc/deliantra-server/${name} and appending the user setting
+ # to it.
+ environment.etc = lib.attrsets.mapAttrs'
+ (name: value: lib.attrsets.nameValuePair "deliantra-server/${name}" {
+ mode = "0644";
+ text =
+ # Deliantra doesn't come with a motd file, but respects it if present
+ # in /etc.
+ (optionalString (name != "motd")
+ (fileContents "${cfg.package}/etc/deliantra-server/${name}"))
+ + "\n${value}";
+ }) ({
+ motd = "";
+ settings = "";
+ config = "";
+ dm_file = "";
+ } // cfg.configFiles);
+
+ systemd.services.deliantra-server = {
+ description = "Deliantra Server Daemon";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+
+ environment = {
+ DELIANTRA_DATADIR="${cfg.dataDir}";
+ DELIANTRA_LOCALDIR="${cfg.stateDir}";
+ DELIANTRA_CONFDIR="/etc/deliantra-server";
+ };
+
+ serviceConfig = mkMerge [
+ {
+ ExecStart = "${cfg.package}/bin/deliantra-server";
+ Restart = "always";
+ User = "deliantra";
+ Group = "deliantra";
+ WorkingDirectory = cfg.stateDir;
+ }
+ (mkIf (cfg.stateDir == "/var/lib/deliantra") {
+ StateDirectory = "deliantra";
+ })
+ ];
+
+ # The deliantra server needs access to a bunch of files at runtime that
+ # are not created automatically at server startup; they're meant to be
+ # installed in $PREFIX/var/deliantra-server by `make install`. And those
+ # files need to be writeable, so we can't just point at the ones in the
+ # nix store. Instead we take the approach of copying them out of the store
+ # on first run. If `bookarch` already exists, we assume the rest of the
+ # files do as well, and copy nothing -- otherwise we risk ovewriting
+ # server state information every time the server is upgraded.
+ preStart = ''
+ if [ ! -e "${cfg.stateDir}"/bookarch ]; then
+ ${pkgs.rsync}/bin/rsync -a --chmod=u=rwX,go=rX \
+ "${cfg.package}/var/deliantra-server/" "${cfg.stateDir}/"
+ fi
+ '';
+ };
+
+ networking.firewall = mkIf cfg.openFirewall {
+ allowedTCPPorts = [ serverPort ];
+ };
+ };
+}
diff --git a/pkgs/development/libraries/blitz/default.nix b/pkgs/development/libraries/blitz/default.nix
new file mode 100644
index 000000000000..f47b051caadf
--- /dev/null
+++ b/pkgs/development/libraries/blitz/default.nix
@@ -0,0 +1,67 @@
+{ stdenv, lib, fetchFromGitHub, pkg-config, gfortran, texinfo, python, boost
+# Select SIMD alignment width (in bytes) for vectorization.
+, simdWidth ? 1
+# Pad arrays to simdWidth by default?
+# Note: Only useful if simdWidth > 1
+, enablePadding ? false
+# Activate serialization through Boost.Serialize?
+, enableSerialization ? true
+# Activate test-suite?
+# WARNING: Some of the tests require up to 1700MB of memory to compile.
+, doCheck ? true
+}:
+
+let
+ inherit (lib) optional optionals;
+in
+stdenv.mkDerivation rec {
+ pname = "blitz++";
+ version = "1.0.1";
+
+ src = fetchFromGitHub {
+ owner = "blitzpp";
+ repo = "blitz";
+ rev = "1.0.1";
+ sha256 = "0nq84vwvvbq7m0my6h835ijfw53bxdp42qjc6kjhk436888qy9rh";
+ };
+
+ nativeBuildInputs = [ pkg-config python texinfo ];
+ buildInputs = [ gfortran texinfo boost ];
+
+ configureFlags =
+ [ "--enable-shared"
+ "--disable-static"
+ "--enable-fortran"
+ "--enable-optimize"
+ "--with-pic=yes"
+ "--enable-html-docs"
+ "--disable-doxygen"
+ "--disable-dot"
+ "--disable-latex-docs"
+ "--enable-simd-width=${toString simdWidth}"
+ "--with-boost=${boost.dev}"
+ "--with-boost-libdir=${boost.out}/lib"
+ ] ++ optional enablePadding "--enable-array-length-padding"
+ ++ optional enableSerialization "--enable-serialization"
+ ++ optional stdenv.is64bit "--enable-64bit";
+
+ enableParallelBuilding = true;
+
+ inherit doCheck;
+ checkTarget = "check-testsuite check-examples";
+
+ meta = with lib; {
+ description = "Fast multi-dimensional array library for C++";
+ homepage = https://sourceforge.net/projects/blitz/;
+ license = licenses.lgpl3;
+ platforms = platforms.unix;
+ maintainers = with maintainers; [ ToxicFrog ];
+ longDescription = ''
+ Blitz++ is a C++ class library for scientific computing which provides
+ performance on par with Fortran 77/90. It uses template techniques to
+ achieve high performance. Blitz++ provides dense arrays and vectors,
+ random number generators, and small vectors (useful for representing
+ multicomponent or vector fields).
+ '';
+ };
+}
diff --git a/pkgs/games/crossfire/crossfire-arch.nix b/pkgs/games/crossfire/crossfire-arch.nix
new file mode 100644
index 000000000000..ff9e0f9dea6d
--- /dev/null
+++ b/pkgs/games/crossfire/crossfire-arch.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib, fetchsvn,
+ version, rev, sha256 }:
+
+stdenv.mkDerivation rec {
+ pname = "crossfire-arch";
+ version = "r${toString rev}";
+
+ src = fetchsvn {
+ url = "http://svn.code.sf.net/p/crossfire/code/arch/trunk/";
+ sha256 = sha256;
+ rev = rev;
+ };
+
+ installPhase = ''
+ mkdir -p "$out"
+ cp -a . "$out/"
+ '';
+
+ meta = with lib; {
+ description = "Archetype data for the Crossfire free MMORPG";
+ homepage = "http://crossfire.real-time.com/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ hydraPlatforms = [];
+ maintainers = with maintainers; [ ToxicFrog ];
+ };
+}
diff --git a/pkgs/games/crossfire/crossfire-client.nix b/pkgs/games/crossfire/crossfire-client.nix
new file mode 100644
index 000000000000..799ae4ab6ee7
--- /dev/null
+++ b/pkgs/games/crossfire/crossfire-client.nix
@@ -0,0 +1,32 @@
+{ stdenv, lib, fetchsvn
+, cmake, pkg-config, perl, vala
+, gtk2, pcre, zlib, libpng, fribidi, harfbuzzFull, xorg, util-linux, curl
+, SDL, SDL_image, SDL_mixer, libselinux, libsepol
+, version, rev, sha256
+}:
+
+stdenv.mkDerivation rec {
+ pname = "crossfire-client";
+ version = "r${toString rev}";
+
+ src = fetchsvn {
+ url = "http://svn.code.sf.net/p/crossfire/code/client/trunk/";
+ sha256 = sha256;
+ rev = rev;
+ };
+
+ nativeBuildInputs = [ cmake pkg-config perl vala ];
+ buildInputs = [
+ gtk2 pcre zlib libpng fribidi harfbuzzFull xorg.libpthreadstubs
+ xorg.libXdmcp curl SDL SDL_image SDL_mixer util-linux libselinux libsepol
+ ];
+ hardeningDisable = [ "format" ];
+
+ meta = with lib; {
+ description = "GTKv2 client for the Crossfire free MMORPG";
+ homepage = "http://crossfire.real-time.com/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ ToxicFrog ];
+ };
+}
diff --git a/pkgs/games/crossfire/crossfire-maps.nix b/pkgs/games/crossfire/crossfire-maps.nix
new file mode 100644
index 000000000000..0521b038d361
--- /dev/null
+++ b/pkgs/games/crossfire/crossfire-maps.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib, fetchsvn,
+ version, rev, sha256 }:
+
+stdenv.mkDerivation rec {
+ pname = "crossfire-maps";
+ version = "r${toString rev}";
+
+ src = fetchsvn {
+ url = "http://svn.code.sf.net/p/crossfire/code/maps/trunk/";
+ sha256 = sha256;
+ rev = rev;
+ };
+
+ installPhase = ''
+ mkdir -p "$out"
+ cp -a . "$out/"
+ '';
+
+ meta = with lib; {
+ description = "Map data for the Crossfire free MMORPG";
+ homepage = "http://crossfire.real-time.com/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ hydraPlatforms = [];
+ maintainers = with maintainers; [ ToxicFrog ];
+ };
+}
diff --git a/pkgs/games/crossfire/crossfire-server.nix b/pkgs/games/crossfire/crossfire-server.nix
new file mode 100644
index 000000000000..9259e8e52faa
--- /dev/null
+++ b/pkgs/games/crossfire/crossfire-server.nix
@@ -0,0 +1,37 @@
+{ stdenv, lib, fetchsvn, autoreconfHook,
+ autoconf, automake, libtool, flex, perl, check, pkg-config, python3,
+ version, rev, sha256, maps, arch }:
+
+stdenv.mkDerivation rec {
+ pname = "crossfire-server";
+ version = "r${toString rev}";
+
+ src = fetchsvn {
+ url = "http://svn.code.sf.net/p/crossfire/code/server/trunk/";
+ sha256 = sha256;
+ rev = rev;
+ };
+
+ nativeBuildInputs = [ autoconf automake libtool flex perl check pkg-config python3 ];
+ hardeningDisable = [ "format" ];
+
+ preConfigure = ''
+ ln -s ${arch} lib/arch
+ ln -s ${maps} lib/maps
+ sh autogen.sh
+ '';
+
+ configureFlags = [ "--with-python=${python3}" ];
+
+ postInstall = ''
+ ln -s ${maps} "$out/share/crossfire/maps"
+ '';
+
+ meta = with lib; {
+ description = "Server for the Crossfire free MMORPG";
+ homepage = "http://crossfire.real-time.com/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ ToxicFrog ];
+ };
+}
diff --git a/pkgs/games/crossfire/default.nix b/pkgs/games/crossfire/default.nix
new file mode 100644
index 000000000000..bc74c00bcce4
--- /dev/null
+++ b/pkgs/games/crossfire/default.nix
@@ -0,0 +1,28 @@
+{ callPackage, ... }:
+
+rec {
+ crossfire-client = callPackage ./crossfire-client.nix {
+ version = "1.75.0";
+ rev = 21760;
+ sha256 = "0b42sak8hj60nywfswkps777asy9p8r9wsn7pmj2nqbd29ng1p9d";
+ };
+
+ crossfire-server = callPackage ./crossfire-server.nix {
+ version = "latest";
+ rev = 22111;
+ sha256 = "04fjif6zv642n2zlw27cgzkak2kknwrxqzg42bvzl7q901bsr9l7";
+ maps = crossfire-maps; arch = crossfire-arch;
+ };
+
+ crossfire-arch = callPackage ./crossfire-arch.nix {
+ version = "latest";
+ rev = 22111;
+ sha256 = "0l4rp3idvbhknpxxs0w4i4nqfg01wblzm4v4j375xwxxbf00j0ms";
+ };
+
+ crossfire-maps = callPackage ./crossfire-maps.nix {
+ version = "latest";
+ rev = 22111;
+ sha256 = "1dwfc84acjvbjgjakkb8z8pdlksbsn90j0z8z8rq37lqx0kx1sap";
+ };
+}
diff --git a/pkgs/games/deliantra/0001-abs.patch b/pkgs/games/deliantra/0001-abs.patch
new file mode 100644
index 000000000000..d116317e243a
--- /dev/null
+++ b/pkgs/games/deliantra/0001-abs.patch
@@ -0,0 +1,17 @@
+--- a/utils/cfhq2xa.C
++++ b/utils/cfhq2xa.C
+@@ -182,10 +182,10 @@ static inline bool Diff (pixel w1, pixel w2)
+ pixel YUV1 = RGBAtoYUVA (w1);
+ pixel YUV2 = RGBAtoYUVA (w2);
+
+- return ((abs (((YUV1 >> Rshift) & Cmask) - ((YUV2 >> Rshift) & Cmask)) > trY) ||
+- (abs (((YUV1 >> Gshift) & Cmask) - ((YUV2 >> Gshift) & Cmask)) > trU) ||
+- (abs (((YUV1 >> Bshift) & Cmask) - ((YUV2 >> Bshift) & Cmask)) > trV) ||
+- (abs (((YUV1 >> Ashift) & Cmask) - ((YUV2 >> Ashift) & Cmask)) > trA) );
++ return ((abs ((signed int)((YUV1 >> Rshift) & Cmask) - (signed int)((YUV2 >> Rshift) & Cmask)) > trY) ||
++ (abs ((signed int)((YUV1 >> Gshift) & Cmask) - (signed int)((YUV2 >> Gshift) & Cmask)) > trU) ||
++ (abs ((signed int)((YUV1 >> Bshift) & Cmask) - (signed int)((YUV2 >> Bshift) & Cmask)) > trV) ||
++ (abs ((signed int)((YUV1 >> Ashift) & Cmask) - (signed int)((YUV2 >> Ashift) & Cmask)) > trA) );
+ }
+
+ static void
diff --git a/pkgs/games/deliantra/0002-datadir.patch b/pkgs/games/deliantra/0002-datadir.patch
new file mode 100644
index 000000000000..1c8e847d88c6
--- /dev/null
+++ b/pkgs/games/deliantra/0002-datadir.patch
@@ -0,0 +1,11 @@
+--- a/utils/cfutil.in
++++ b/utils/cfutil.in
+@@ -27,7 +27,7 @@ use common::sense;
+ my $prefix = "@prefix@";
+ my $exec_prefix = "@exec_prefix@";
+ my $datarootdir = "@datarootdir@";
+-my $DATADIR = "@datadir@/@PACKAGE@";
++my $DATADIR = $ENV{'DELIANTRA_DATADIR'} || "@datadir@/@PACKAGE@";
+
+ my $CONVERT = "@CONVERT@";
+ my $IDENTIFY = "@IDENTIFY@";
diff --git a/pkgs/games/deliantra/default.nix b/pkgs/games/deliantra/default.nix
new file mode 100644
index 000000000000..76a06c960187
--- /dev/null
+++ b/pkgs/games/deliantra/default.nix
@@ -0,0 +1,10 @@
+pkgs:
+
+let
+ callPackage = pkgs.callPackage;
+in {
+ deliantra-server = callPackage ./deliantra-server.nix {};
+ deliantra-arch = callPackage ./deliantra-arch.nix {};
+ deliantra-maps = callPackage ./deliantra-maps.nix {};
+ deliantra-data = callPackage ./deliantra-data.nix {};
+}
diff --git a/pkgs/games/deliantra/deliantra-arch.nix b/pkgs/games/deliantra/deliantra-arch.nix
new file mode 100644
index 000000000000..2201ca2d1f5f
--- /dev/null
+++ b/pkgs/games/deliantra/deliantra-arch.nix
@@ -0,0 +1,25 @@
+{ stdenv, lib, fetchurl, deliantra-server }:
+
+stdenv.mkDerivation rec {
+ pname = "deliantra-arch";
+ version = "3.1";
+
+ src = fetchurl {
+ url = "http://dist.schmorp.de/deliantra/${pname}-${version}.tar.xz";
+ sha256 = "1xzhv48g90hwkzgx9nfjm81ivg6hchkik9ldimi8ijb4j393kvsz";
+ };
+
+ installPhase = ''
+ mkdir -p "$out"
+ export DELIANTRA_DATADIR="$out"
+ ${deliantra-server}/bin/cfutil --install-arch .
+ '';
+
+ meta = with lib; {
+ description = "Archetype data for the Deliantra free MMORPG";
+ homepage = "http://www.deliantra.net/";
+ license = with licenses; [ gpl2Plus agpl3Plus ];
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ ToxicFrog ];
+ };
+}
diff --git a/pkgs/games/deliantra/deliantra-data.nix b/pkgs/games/deliantra/deliantra-data.nix
new file mode 100644
index 000000000000..31ed7d0f0118
--- /dev/null
+++ b/pkgs/games/deliantra/deliantra-data.nix
@@ -0,0 +1,21 @@
+{ stdenv, lib, fetchurl, deliantra-maps, deliantra-arch, deliantra-server, symlinkJoin }:
+
+symlinkJoin rec {
+ name = "deliantra-data-${version}";
+ version = "M${deliantra-maps.version}+A${deliantra-arch.version}";
+
+ paths = [
+ deliantra-maps
+ deliantra-arch
+ "${deliantra-server}/share/deliantra-server"
+ ];
+
+ meta = with lib; {
+ description = "Combined game data (maps + archetypes) for the Deliantra free MMORPG";
+ homepage = "http://www.deliantra.net/";
+ license = with licenses; [ gpl2Plus agpl3Plus ];
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ ToxicFrog ];
+ hydraPlatforms = [];
+ };
+}
diff --git a/pkgs/games/deliantra/deliantra-maps.nix b/pkgs/games/deliantra/deliantra-maps.nix
new file mode 100644
index 000000000000..1f87178102a0
--- /dev/null
+++ b/pkgs/games/deliantra/deliantra-maps.nix
@@ -0,0 +1,25 @@
+{ stdenv, lib, fetchurl, deliantra-server }:
+
+stdenv.mkDerivation rec {
+ pname = "deliantra-maps";
+ version = "3.1";
+
+ src = fetchurl {
+ url = "http://dist.schmorp.de/deliantra/${pname}-${version}.tar.xz";
+ sha256 = "0zbwzya28s1xpnbrmqkqvfrzns03zdjd8a9w9nk665aif6rw2zbz";
+ };
+
+ installPhase = ''
+ mkdir -p "$out/maps"
+ export DELIANTRA_DATADIR="$out"
+ ${deliantra-server}/bin/cfutil --install-maps .
+ '';
+
+ meta = with lib; {
+ description = "Map data for the Deliantra free MMORPG";
+ homepage = "http://www.deliantra.net/";
+ license = with licenses; [ gpl2Plus agpl3Plus ];
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ ToxicFrog ];
+ };
+}
diff --git a/pkgs/games/deliantra/deliantra-server.nix b/pkgs/games/deliantra/deliantra-server.nix
new file mode 100644
index 000000000000..e333b7a472f5
--- /dev/null
+++ b/pkgs/games/deliantra/deliantra-server.nix
@@ -0,0 +1,48 @@
+{ stdenv, lib, fetchurl, perlPackages
+, autoconf, perl, gperf, optipng, pngnq, rsync, imagemagick, blitz
+, pkg-config, glib, boost, makeWrapper
+}:
+
+let
+ perl-deps = with perlPackages; [
+ AnyEvent AnyEventAIO AnyEventBDB AnyEventIRC
+ CompressLZF commonsense Coro CoroEV
+ Deliantra DigestSHA1 EV PodPOM SafeHole URI YAMLLibYAML
+ ];
+in
+stdenv.mkDerivation rec {
+ pname = "deliantra-server";
+ version = "3.1";
+
+ src = fetchurl {
+ url = "http://dist.schmorp.de/deliantra/${pname}-${version}.tar.xz";
+ sha256 = "0v0m2m9fxq143aknh7jb3qj8bnpjrs3bpbbx07c18516y3izr71d";
+ };
+
+ nativeBuildInputs = [
+ autoconf perl gperf optipng pngnq rsync imagemagick
+ pkg-config makeWrapper
+ ];
+ propagatedBuildInputs = perl-deps;
+ buildInputs = [
+ blitz boost glib
+ ];
+
+ hardeningDisable = [ "format" ];
+ patches = [
+ ./0001-abs.patch
+ ./0002-datadir.patch
+ ];
+ postFixup = ''
+ wrapProgram $out/bin/cfutil --prefix PERL5LIB : $PERL5LIB
+ wrapProgram $out/bin/deliantra-server --prefix PERL5LIB : $PERL5LIB
+ '';
+
+ meta = with lib; {
+ description = "Server for the Deliantra free MMORPG";
+ homepage = "http://www.deliantra.net/";
+ license = with licenses; [ gpl2Plus agpl3Plus ];
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ ToxicFrog ];
+ };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 748f70eefeef..1c8f46e21d94 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2001,6 +2001,8 @@ with pkgs;
blink = libsForQt5.callPackage ../applications/networking/instant-messengers/blink { };
+ blitz = callPackage ../development/libraries/blitz { };
+
blockbook = callPackage ../servers/blockbook { };
blockhash = callPackage ../tools/graphics/blockhash { };
@@ -29450,6 +29452,9 @@ with pkgs;
crawl = callPackage ../games/crawl { };
+ inherit (import ../games/crossfire pkgs)
+ crossfire-server crossfire-arch crossfire-maps crossfire-client;
+
crrcsim = callPackage ../games/crrcsim {};
curseofwar = callPackage ../games/curseofwar { SDL = null; };
@@ -29459,6 +29464,9 @@ with pkgs;
cuyo = callPackage ../games/cuyo { };
+ inherit (import ../games/deliantra pkgs)
+ deliantra-server deliantra-arch deliantra-maps deliantra-data;
+
devilutionx = callPackage ../games/devilutionx {};
dhewm3 = callPackage ../games/dhewm3 {};
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index d24a58754dc5..7b84593b13bf 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -392,6 +392,20 @@ let
};
};
+ AnyEventBDB = buildPerlPackage rec {
+ pname = "AnyEvent-BDB";
+ version = "1.1";
+ src = fetchurl {
+ url = "mirror://cpan/authors/id/M/ML/MLEHMANN/${pname}-${version}.tar.gz";
+ sha256 = "93e