{ stdenv , lib , pkg-config , fetchFromGitLab , gitUpdater , ffmpeg_6 # for daemon , autoreconfHook , perl # for pod2man , alsa-lib , asio , dbus , sdbus-cpp , fmt , gmp , gnutls , http-parser , jack , jsoncpp , libarchive , libgit2 , libnatpmp , libpulseaudio , libupnp , yaml-cpp , msgpack-cxx , openssl , restinio , secp256k1 , speex , udev , webrtc-audio-processing , zlib # for client , cmake , networkmanager # for libnm , python3 , qttools # for translations , wrapQtAppsHook , libnotify , qt5compat , qtbase , qtdeclarative , qrencode , qtmultimedia , qtnetworkauth , qtpositioning , qtsvg , qtwebengine , qtwebchannel , wrapGAppsHook , withWebengine ? true # for pjsip , fetchFromGitHub , pjsip # for opendht , opendht }: let readLinesToList = with builtins; file: filter (s: isString s && stringLength s > 0) (split "\n" (readFile file)); in stdenv.mkDerivation rec { pname = "jami"; version = "20231201.0"; src = fetchFromGitLab { domain = "git.jami.net"; owner = "savoirfairelinux"; repo = "jami-client-qt"; rev = "stable/${version}"; hash = "sha256-A38JwjqdQVy03d738p2tpTFA6EWRSPNiesS5wZfti7Y="; fetchSubmodules = true; }; pjsip-jami = pjsip.overrideAttrs (old: let patch-src = src + "/daemon/contrib/src/pjproject/"; in rec { version = "311bd018fc07aaf62d4c2d2494e08b5ee97e6846"; src = fetchFromGitHub { owner = "savoirfairelinux"; repo = "pjproject"; rev = version; hash = "sha256-pZiOSOUxAXzMY4c1/AyKcwa7nyIJC/ZVOqDg9/QO/Nk="; }; patches = (map (x: patch-src + x) (readLinesToList ./config/pjsip_patches)); configureFlags = (readLinesToList ./config/pjsip_args_common) ++ lib.optionals stdenv.isLinux (readLinesToList ./config/pjsip_args_linux); }); opendht-jami = opendht.override { enableProxyServerAndClient = true; enablePushNotifications = true; }; dhtnet = stdenv.mkDerivation { pname = "dhtnet"; version = "unstable-2023-11-23"; src = fetchFromGitLab { domain = "git.jami.net"; owner = "savoirfairelinux"; repo = "dhtnet"; rev = "b1bcdecbac2a41de3941ef5a34faa6fbe4472535"; hash = "sha256-EucSsUuHXbVqr7drrTLK0f+WZT2k9Tx/LV+IBldTQO8="; }; nativeBuildInputs = [ cmake pkg-config ]; buildInputs = [ asio fmt gnutls http-parser jsoncpp libupnp msgpack-cxx opendht-jami openssl pjsip-jami restinio ]; cmakeFlags = [ "-DBUILD_SHARED_LIBS=Off" "-DBUILD_BENCHMARKS=Off" "-DBUILD_TOOLS=Off" "-DBUILD_TESTING=Off" ]; meta = with lib; { description = "Lightweight Peer-to-Peer Communication Library"; license = licenses.gpl3Only; platforms = platforms.linux; maintainers = [ maintainers.linsui ]; }; }; daemon = stdenv.mkDerivation { pname = "jami-daemon"; inherit src version meta; sourceRoot = "${src.name}/daemon"; nativeBuildInputs = [ autoreconfHook pkg-config perl ]; buildInputs = [ alsa-lib asio dbus dhtnet sdbus-cpp fmt ffmpeg_6 gmp gnutls http-parser jack jsoncpp libarchive libgit2 libnatpmp libpulseaudio libupnp yaml-cpp msgpack-cxx opendht-jami openssl pjsip-jami restinio secp256k1 speex udev webrtc-audio-processing zlib ]; enableParallelBuilding = true; }; preConfigure = '' echo 'const char VERSION_STRING[] = "${version}";' > src/app/version.h # Currently the daemon is still built seperately but jami expects it in CMAKE_INSTALL_PREFIX # This can be removed in future versions when JAMICORE_AS_SUBDIR is on mkdir -p $out ln -s ${daemon} $out/daemon ''; dontWrapGApps = true; nativeBuildInputs = [ wrapGAppsHook wrapQtAppsHook pkg-config cmake python3 qttools ]; buildInputs = [ ffmpeg_6 libnotify networkmanager qtbase qt5compat qrencode qtnetworkauth qtdeclarative qtmultimedia qtpositioning qtsvg qtwebchannel ] ++ lib.optionals withWebengine [ qtwebengine ]; cmakeFlags = lib.optionals (!withWebengine) [ "-DWITH_WEBENGINE=false" ]; qtWrapperArgs = [ # With wayland the titlebar is not themed and the wmclass is wrong. "--set-default QT_QPA_PLATFORM xcb" ]; preFixup = '' qtWrapperArgs+=("''${gappsWrapperArgs[@]}") ''; passthru.updateScript = gitUpdater { rev-prefix = "stable/"; }; meta = with lib; { homepage = "https://jami.net/"; description = "The free and universal communication platform that respects the privacy and freedoms of its users"; mainProgram = "jami"; license = licenses.gpl3Plus; platforms = platforms.linux; maintainers = [ maintainers.linsui ]; }; }