nixpkgs/pkgs/servers/xmpp/prosody/default.nix
Félix Baylac-Jacqué 3469429c39
prosody: remove outdated passthrough test reference
4369bebd9a removed the prosody-mysql
test. We forgot to remove the associated passthru test entry in the
prosody derivation.
2022-01-15 16:41:13 +01:00

100 lines
2.8 KiB
Nix

{ stdenv, fetchurl, lib, libidn, openssl, makeWrapper, fetchhg
, lua
, nixosTests
, withLibevent ? true
, withDBI ? true
# use withExtraLibs to add additional dependencies of community modules
, withExtraLibs ? [ ]
, withOnlyInstalledCommunityModules ? [ ]
, withCommunityModules ? [ ] }:
with lib;
let
luaEnv = lua.withPackages(p: with p; [
luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3
]
++ lib.optional withLibevent p.luaevent
++ lib.optional withDBI p.luadbi
);
in
stdenv.mkDerivation rec {
version = "0.11.12"; # 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 = [
"bookmarks"
"cloud_notify"
"vcard_muc"
"smacks"
"http_upload"
];
src = fetchurl {
url = "https://prosody.im/downloads/source/${pname}-${version}.tar.gz";
sha256 = "03an206bl3h2lqcgv1wfvc2bqjq6m9vjb2idw0vyvczm43c55kan";
};
# 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 = "bd0a1f917d98";
sha256 = "0figx0b0y5zfk5anf16h20y4crjmpb6bkg30vl7p0m594qnyqjcx";
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
luaEnv libidn openssl
]
++ withExtraLibs;
configureFlags = [
"--ostype=linux"
"--with-lua-include=${luaEnv}/include"
"--with-lua=${luaEnv}"
];
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/prosody \
--prefix LUA_PATH ';' "$LUA_PATH" \
--prefix LUA_CPATH ';' "$LUA_CPATH"
wrapProgram $out/bin/prosodyctl \
--add-flags '--config "/etc/prosody/prosody.cfg.lua"' \
--prefix LUA_PATH ';' "$LUA_PATH" \
--prefix LUA_CPATH ';' "$LUA_CPATH"
make -C tools/migration install
wrapProgram $out/bin/prosody-migrator \
--prefix LUA_PATH ';' "$LUA_PATH" \
--prefix LUA_CPATH ';' "$LUA_CPATH"
'';
passthru = {
communityModules = withCommunityModules;
tests = {
main = nixosTests.prosody;
};
};
meta = {
description = "Open-source XMPP application server written in Lua";
license = licenses.mit;
homepage = "https://prosody.im";
platforms = platforms.linux;
maintainers = with maintainers; [ fpletz globin ninjatrappeur ];
};
}