about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/xmpp
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/xmpp')
-rw-r--r--nixpkgs/pkgs/servers/xmpp/biboumi/catch.patch30
-rw-r--r--nixpkgs/pkgs/servers/xmpp/biboumi/default.nix42
-rw-r--r--nixpkgs/pkgs/servers/xmpp/ejabberd/default.nix127
-rw-r--r--nixpkgs/pkgs/servers/xmpp/prosody-filer/default.nix26
-rw-r--r--nixpkgs/pkgs/servers/xmpp/prosody/default.nix89
5 files changed, 314 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/xmpp/biboumi/catch.patch b/nixpkgs/pkgs/servers/xmpp/biboumi/catch.patch
new file mode 100644
index 000000000000..bbd0a66909fe
--- /dev/null
+++ b/nixpkgs/pkgs/servers/xmpp/biboumi/catch.patch
@@ -0,0 +1,30 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -303,27 +303,6 @@
+ endforeach()
+ 
+ #
+-## Add a rule to download the catch unit test framework
+-#
+-include(ExternalProject)
+-ExternalProject_Add(catch
+-  GIT_REPOSITORY "https://lab.louiz.org/louiz/Catch.git"
+-  PREFIX "external"
+-  UPDATE_COMMAND ""
+-  CONFIGURE_COMMAND ""
+-  BUILD_COMMAND ""
+-  INSTALL_COMMAND ""
+-  )
+-set_target_properties(catch PROPERTIES EXCLUDE_FROM_ALL TRUE)
+-ExternalProject_Get_Property(catch SOURCE_DIR)
+-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tests/catch.hpp)
+-  target_include_directories(test_suite
+-    PUBLIC "${SOURCE_DIR}/single_include/"
+-    )
+-  add_dependencies(test_suite catch)
+-endif()
+-
+-#
+ ## Add some custom rules to launch the tests
+ #
+ add_custom_target(check COMMAND "test_suite"
diff --git a/nixpkgs/pkgs/servers/xmpp/biboumi/default.nix b/nixpkgs/pkgs/servers/xmpp/biboumi/default.nix
new file mode 100644
index 000000000000..9d63356abd6b
--- /dev/null
+++ b/nixpkgs/pkgs/servers/xmpp/biboumi/default.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, fetchurl, fetchgit, cmake, libuuid, expat, sqlite, libidn
+, libiconv, botan2, systemd, pkg-config, udns, python3Packages } :
+
+let
+  louiz_catch = fetchgit {
+    url = "https://lab.louiz.org/louiz/Catch.git";
+    rev = "0a34cc201ef28bf25c88b0062f331369596cb7b7"; # v2.2.1
+    sha256 = "0ad0sjhmzx61a763d2ali4vkj8aa1sbknnldks7xlf4gy83jfrbl";
+  };
+in
+stdenv.mkDerivation rec {
+  pname = "biboumi";
+  version = "9.0";
+
+  src = fetchurl {
+    url = "https://git.louiz.org/biboumi/snapshot/biboumi-${version}.tar.xz";
+    sha256 = "1jvygri165aknmvlinx3jb8cclny6cxdykjf8dp0a3l3228rmzqy";
+  };
+
+  patches = [ ./catch.patch ];
+
+  nativeBuildInputs = [ cmake pkg-config python3Packages.sphinx ];
+  buildInputs = [ libuuid expat sqlite libiconv libidn botan2 systemd udns ];
+
+  buildFlags = [ "all" "man" ];
+
+  preConfigure = ''
+    substituteInPlace CMakeLists.txt --replace /etc/biboumi $out/etc/biboumi
+    cp ${louiz_catch}/single_include/catch.hpp tests/
+  '';
+
+  doCheck = true;
+
+  meta = with lib; {
+    description = "Modern XMPP IRC gateway";
+    mainProgram = "biboumi";
+    platforms = platforms.unix;
+    homepage = "https://lab.louiz.org/louiz/biboumi";
+    license = licenses.zlib;
+    maintainers = [ maintainers.woffs ];
+  };
+}
diff --git a/nixpkgs/pkgs/servers/xmpp/ejabberd/default.nix b/nixpkgs/pkgs/servers/xmpp/ejabberd/default.nix
new file mode 100644
index 000000000000..821465ec3a52
--- /dev/null
+++ b/nixpkgs/pkgs/servers/xmpp/ejabberd/default.nix
@@ -0,0 +1,127 @@
+{ stdenv, writeScriptBin, makeWrapper, lib, fetchurl, git, cacert, libpng, libjpeg, libwebp
+, erlang, openssl, expat, libyaml, bash, gnused, gnugrep, coreutils, util-linux, procps, gd
+, flock, autoreconfHook
+, gawk
+, nixosTests
+, withMysql ? false
+, withPgsql ? false
+, withSqlite ? false, sqlite
+, withPam ? false, pam
+, withZlib ? true, zlib
+, withTools ? false
+, withRedis ? false
+, withImagemagick ? false, imagemagick
+}:
+
+let
+  ctlpath = lib.makeBinPath [ bash gnused gnugrep gawk coreutils util-linux procps ];
+in stdenv.mkDerivation rec {
+  pname = "ejabberd";
+  version = "23.10";
+
+  nativeBuildInputs = [ makeWrapper autoreconfHook ];
+
+  buildInputs = [ erlang openssl expat libyaml gd ]
+    ++ lib.optional withSqlite sqlite
+    ++ lib.optional withPam pam
+    ++ lib.optional withZlib zlib
+  ;
+
+  src = fetchurl {
+    url = "https://www.process-one.net/downloads/downloads-action.php?file=/${version}/ejabberd-${version}.tar.gz";
+    hash = "sha256-DW5/DYLZHNqJ4lddmag1B0E9ov/eObIVGASUeioPolg=";
+    # remember to update the deps FOD hash & its pinned ejabberd-po commit
+  };
+
+  passthru.tests = {
+    inherit (nixosTests) ejabberd;
+  };
+
+  deps = stdenv.mkDerivation {
+    pname = "ejabberd-deps";
+
+    inherit src version;
+
+    # pin ejabberd-po dep
+    # update: curl -L api.github.com/repos/processone/ejabberd-po/branches/main | jq .commit.sha -r
+    postPatch = ''
+      substituteInPlace rebar.config \
+        --replace \
+          '{git, "https://github.com/processone/ejabberd-po", {branch, "main"}}' \
+          '{git, "https://github.com/processone/ejabberd-po", {tag, "26d6463386588d39f07027dabff3cb8dd938bf6b"}}'
+    '';
+
+    configureFlags = [ "--enable-all" "--with-sqlite3=${sqlite.dev}" ];
+
+    nativeBuildInputs = [
+      git erlang openssl expat libyaml sqlite pam zlib autoreconfHook
+    ];
+
+    GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
+
+    makeFlags = [ "deps" ];
+
+    installPhase = ''
+      for i in deps/*; do
+        ( cd $i
+          git reset --hard
+          git clean -ffdx
+          git describe --always --tags > .rev
+          rm -rf .git .github
+        )
+      done
+      # not a typo; comes from `make deps`
+      rm deps/.got
+
+      cp -r deps $out
+    '';
+
+    dontPatchELF = true;
+    dontStrip = true;
+    # avoid /nix/store references in the source
+    dontPatchShebangs = true;
+
+    outputHashAlgo = "sha256";
+    outputHashMode = "recursive";
+    outputHash = "sha256-HrLu3wTF+cUxpGX0yK3nbB57SRM2ND3Crlxs5/8FIwI=";
+  };
+
+  configureFlags = [
+    (lib.enableFeature withMysql "mysql")
+    (lib.enableFeature withPgsql "pgsql")
+    (lib.enableFeature withSqlite "sqlite")
+    (lib.enableFeature withPam "pam")
+    (lib.enableFeature withZlib "zlib")
+    (lib.enableFeature withTools "tools")
+    (lib.enableFeature withRedis "redis")
+  ] ++ lib.optional withSqlite "--with-sqlite3=${sqlite.dev}";
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    cp -r $deps deps
+    chmod -R +w deps
+    patchShebangs .
+  '';
+
+  postInstall = ''
+    sed -i \
+      -e '2iexport PATH=${ctlpath}:$PATH' \
+      -e 's,\(^ *FLOCK=\).*,\1${flock}/bin/flock,' \
+      -e 's,\(^ *JOT=\).*,\1,' \
+      -e 's,\(^ *CONNLOCKDIR=\).*,\1/var/lock/ejabberdctl,' \
+      $out/sbin/ejabberdctl
+    wrapProgram $out/lib/eimp-*/priv/bin/eimp --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libpng libjpeg libwebp ]}"
+    ${lib.optionalString withImagemagick ''wrapProgram $out/lib/ejabberd-*/priv/bin/captcha.sh --prefix PATH : "${lib.makeBinPath [ imagemagick ]}"''}
+    rm $out/bin/{mix,iex,elixir}
+  '';
+
+  meta = with lib; {
+    description = "Open-source XMPP application server written in Erlang";
+    mainProgram = "ejabberdctl";
+    license = licenses.gpl2;
+    homepage = "https://www.ejabberd.im";
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ sander abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/servers/xmpp/prosody-filer/default.nix b/nixpkgs/pkgs/servers/xmpp/prosody-filer/default.nix
new file mode 100644
index 000000000000..11ba842e5cb8
--- /dev/null
+++ b/nixpkgs/pkgs/servers/xmpp/prosody-filer/default.nix
@@ -0,0 +1,26 @@
+{ lib, buildGoModule, fetchFromGitHub }:
+
+buildGoModule rec {
+  pname = "prosody-filer";
+  version = "unstable-2021-05-24";
+
+  src = fetchFromGitHub {
+    owner = "ThomasLeister";
+    repo = "prosody-filer";
+    rev = "c65edd199b47dc505366c85b3702230fda797cd6";
+    hash = "sha256-HrCJjsa3cYK1g7ylkDiCikgxJzbuGg1/5Zz4R12520A=";
+  };
+
+  vendorHash = "sha256-bbkCxS0UU8PIg/Xjo2X1Mia3WHjtBxYGmwj1c/ScVxc=";
+
+  doCheck = false;
+
+  meta = with lib; {
+    homepage = "https://github.com/ThomasLeister/prosody-filer";
+    maintainers = with maintainers; [ abbradar ];
+    license = licenses.mit;
+    platforms = platforms.linux;
+    description = "A simple file server for handling XMPP http_upload requests";
+    mainProgram = "prosody-filer";
+  };
+}
diff --git a/nixpkgs/pkgs/servers/xmpp/prosody/default.nix b/nixpkgs/pkgs/servers/xmpp/prosody/default.nix
new file mode 100644
index 000000000000..2f237c1f2277
--- /dev/null
+++ b/nixpkgs/pkgs/servers/xmpp/prosody/default.nix
@@ -0,0 +1,89 @@
+{ stdenv, fetchurl, lib, libidn, openssl, makeWrapper, fetchhg, buildPackages
+, icu
+, lua
+, nixosTests
+, withDBI ? true
+# use withExtraLibs to add additional dependencies of community modules
+, withExtraLibs ? [ ]
+, withExtraLuaPackages ? _: [ ]
+, withOnlyInstalledCommunityModules ? [ ]
+, withCommunityModules ? [ ] }:
+
+with lib;
+
+let
+  luaEnv = lua.withPackages(p: with p; [
+      luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3 luaunbound
+    ]
+    ++ lib.optional withDBI p.luadbi
+    ++ withExtraLuaPackages p
+  );
+in
+stdenv.mkDerivation rec {
+  version = "0.12.4"; # also update communityModules
+  pname = "prosody";
+  # The following community modules are necessary for the nixos module
+  # prosody module to comply with XEP-0423 and provide a working
+  # default setup.
+  nixosModuleDeps = [
+    "cloud_notify"
+    "vcard_muc"
+    "http_upload"
+  ];
+  src = fetchurl {
+    url = "https://prosody.im/downloads/source/${pname}-${version}.tar.gz";
+    sha256 = "R9cSJzwvKVWMQS9s2uwHMmC7wmt92iQ9tYAzAYPWWFY=";
+  };
+
+  # A note to all those merging automated updates: Please also update this
+  # attribute as some modules might not be compatible with a newer prosody
+  # version.
+  communityModules = fetchhg {
+    url = "https://hg.prosody.im/prosody-modules";
+    rev = "b109773ce6fe";
+    hash = "sha256-N1vmShDWtWsHD4b1x7UjX6Sj28iPaDeCLSYeDOLLhzo=";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [
+    luaEnv libidn openssl icu
+  ]
+  ++ withExtraLibs;
+
+  configureFlags = [
+    "--ostype=linux"
+    "--with-lua-bin=${lib.getBin buildPackages.lua}/bin"
+    "--with-lua-include=${luaEnv}/include"
+    "--with-lua=${luaEnv}"
+    "--c-compiler=${stdenv.cc.targetPrefix}cc"
+    "--linker=${stdenv.cc.targetPrefix}cc"
+  ];
+  configurePlatforms = [];
+
+  postBuild = ''
+    make -C tools/migration
+  '';
+
+  # the wrapping should go away once lua hook is fixed
+  postInstall = ''
+      ${concatMapStringsSep "\n" (module: ''
+        cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
+      '') (lib.lists.unique(nixosModuleDeps ++ withCommunityModules ++ withOnlyInstalledCommunityModules))}
+      wrapProgram $out/bin/prosodyctl \
+        --add-flags '--config "/etc/prosody/prosody.cfg.lua"'
+      make -C tools/migration install
+    '';
+
+  passthru = {
+    communityModules = withCommunityModules;
+    tests = { inherit (nixosTests) prosody prosody-mysql; };
+  };
+
+  meta = {
+    description = "Open-source XMPP application server written in Lua";
+    license = licenses.mit;
+    homepage = "https://prosody.im";
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ toastal ];
+  };
+}