1 { stdenv, fetchurl, lib, libidn, openssl, makeWrapper, fetchhg, buildPackages
6 # use withExtraLibs to add additional dependencies of community modules
8 , withExtraLuaPackages ? _: [ ]
9 , withOnlyInstalledCommunityModules ? [ ]
10 , withCommunityModules ? [ ] }:
13 luaEnv = lua.withPackages(p: with p; [
14 luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3 luaunbound
16 ++ lib.optional withDBI p.luadbi
17 ++ withExtraLuaPackages p
20 stdenv.mkDerivation rec {
21 version = "0.12.4"; # also update communityModules
23 # The following community modules are necessary for the nixos module
24 # prosody module to comply with XEP-0423 and provide a working
32 url = "https://prosody.im/downloads/source/${pname}-${version}.tar.gz";
33 sha256 = "R9cSJzwvKVWMQS9s2uwHMmC7wmt92iQ9tYAzAYPWWFY=";
36 # A note to all those merging automated updates: Please also update this
37 # attribute as some modules might not be compatible with a newer prosody
39 communityModules = fetchhg {
40 url = "https://hg.prosody.im/prosody-modules";
42 hash = "sha256-qLuhEdvtOMfu78oxLUZKWZDb/AME1+IRnk0jkQNxTU8=";
45 nativeBuildInputs = [ makeWrapper ];
47 luaEnv libidn openssl icu
53 "--with-lua-bin=${lib.getBin buildPackages.lua}/bin"
54 "--with-lua-include=${luaEnv}/include"
55 "--with-lua=${luaEnv}"
56 "--c-compiler=${stdenv.cc.targetPrefix}cc"
57 "--linker=${stdenv.cc.targetPrefix}cc"
59 configurePlatforms = [];
62 make -C tools/migration
66 # don't search for configs in the nix store when running prosodyctl
67 "INSTALLEDCONFIG=/etc/prosody"
68 "INSTALLEDDATA=/var/lib/prosody"
71 # the wrapping should go away once lua hook is fixed
73 ${lib.concatMapStringsSep "\n" (module: ''
74 cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
75 '') (lib.lists.unique(nixosModuleDeps ++ withCommunityModules ++ withOnlyInstalledCommunityModules))}
76 make -C tools/migration install
80 communityModules = withCommunityModules;
81 tests = { inherit (nixosTests) prosody prosody-mysql; };
85 description = "Open-source XMPP application server written in Lua";
86 license = licenses.mit;
87 homepage = "https://prosody.im";
88 platforms = platforms.linux;
89 maintainers = with maintainers; [ toastal ];