pidgin: put packages in a different scope

Signed-off-by: lucasew <lucas59356@gmail.com>
This commit is contained in:
lucasew 2023-07-15 13:21:47 -03:00 committed by Anderson Torres
parent 99d417bab0
commit af38d77aa7
30 changed files with 231 additions and 137 deletions

View file

@ -1,99 +1,149 @@
{ callPackage, stdenv, fetchurl, makeWrapper, pkg-config, gtk2, gtk2-x11, gtkspell2, aspell
, gst_all_1, libstartup_notification, gettext, perlPackages, libxml2, nss
, nspr, farstream, libXScrnSaver, avahi, dbus, dbus-glib, intltool, libidn
, lib, python3, libICE, libXext, libSM, libgnt, ncurses, cyrus_sasl, openssl
, gnutls, libgcrypt, cacert, plugins, withOpenssl, withGnutls, withCyrus_sasl ? true
{ stdenv
, callPackage
, fetchurl
, makeWrapper
, aspell
, avahi
, cacert
, dbus
, dbus-glib
, farstream
, gettext
, gst_all_1
, gtk2
, gtk2-x11
, gtkspell2
, intltool
, lib
, libICE
, libSM
, libXScrnSaver
, libXext
, libgcrypt
, libgnt
, libidn
, libstartup_notification
, libxml2
, ncurses
, nspr
, nss
, perlPackages
, pkg-config
, python3
, pidgin
, plugins ? []
, withOpenssl ? false, openssl
, withGnutls ? false , gnutls
, withCyrus_sasl ? true, cyrus_sasl
, pidginPackages
}:
# FIXME: clean the mess around choosing the SSL library (nss by default)
let unwrapped = stdenv.mkDerivation rec {
pname = "pidgin";
version = "2.14.12";
let
unwrapped = stdenv.mkDerivation rec {
pname = "pidgin";
version = "2.14.12";
src = fetchurl {
url = "mirror://sourceforge/pidgin/pidgin-${version}.tar.bz2";
sha256 = "sha256-KwUka+IIYF7buTrp7cB5WD1EniqXENttNI0X9ZAgpLc=";
};
src = fetchurl {
url = "mirror://sourceforge/pidgin/pidgin-${version}.tar.bz2";
sha256 = "sha256-KwUka+IIYF7buTrp7cB5WD1EniqXENttNI0X9ZAgpLc=";
};
nativeBuildInputs = [ makeWrapper intltool ];
nativeBuildInputs = [ makeWrapper intltool ];
env.NIX_CFLAGS_COMPILE = "-I${gst_all_1.gst-plugins-base.dev}/include/gstreamer-1.0";
env.NIX_CFLAGS_COMPILE = "-I${gst_all_1.gst-plugins-base.dev}/include/gstreamer-1.0";
buildInputs = let
python-with-dbus = python3.withPackages (pp: with pp; [ dbus-python ]);
in [
aspell libstartup_notification
gst_all_1.gstreamer gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good
libxml2 nss nspr
libXScrnSaver python-with-dbus
avahi dbus dbus-glib libidn
libICE libXext libSM cyrus_sasl
libgnt ncurses # optional: build finch - the console UI
]
++ lib.optional withOpenssl openssl
++ lib.optionals withGnutls [ gnutls libgcrypt ]
++ lib.optionals stdenv.isLinux [ gtk2 gtkspell2 farstream ]
++ lib.optional stdenv.isDarwin gtk2-x11;
propagatedBuildInputs = [ pkg-config gettext ]
++ (with perlPackages; [ perl XMLParser ])
++ lib.optional stdenv.isLinux gtk2
buildInputs = let
python-with-dbus = python3.withPackages (pp: with pp; [ dbus-python ]);
in [
aspell
avahi
cyrus_sasl
dbus
dbus-glib
gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good
gst_all_1.gstreamer
libICE
libSM
libXScrnSaver
libXext
libgnt
libidn
libstartup_notification
libxml2
ncurses # optional: build finch - the console UI
nspr
nss
python-with-dbus
]
++ lib.optional withOpenssl openssl
++ lib.optionals withGnutls [ gnutls libgcrypt ]
++ lib.optionals stdenv.isLinux [ gtk2 gtkspell2 farstream ]
++ lib.optional stdenv.isDarwin gtk2-x11;
patches = [ ./pidgin-makefile.patch ./add-search-path.patch ];
configureFlags = [
"--with-nspr-includes=${nspr.dev}/include/nspr"
"--with-nspr-libs=${nspr.out}/lib"
"--with-nss-includes=${nss.dev}/include/nss"
"--with-nss-libs=${nss.out}/lib"
"--with-ncurses-headers=${ncurses.dev}/include"
"--with-system-ssl-certs=${cacert}/etc/ssl/certs"
"--disable-meanwhile"
"--disable-nm"
"--disable-tcl"
"--disable-gevolution"
]
++ lib.optionals withCyrus_sasl [ "--enable-cyrus-sasl=yes" ]
++ lib.optionals withGnutls ["--enable-gnutls=yes" "--enable-nss=no"]
++ lib.optionals stdenv.isDarwin ["--disable-gtkspell" "--disable-vv"];
propagatedBuildInputs = [ pkg-config gettext ]
++ (with perlPackages; [ perl XMLParser ])
++ lib.optional stdenv.isLinux gtk2
++ lib.optional stdenv.isDarwin gtk2-x11;
enableParallelBuilding = true;
patches = [
./add-search-path.patch
./pidgin-makefile.patch
];
postInstall = ''
wrapProgram $out/bin/pidgin \
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0"
'';
configureFlags = [
"--with-nspr-includes=${nspr.dev}/include/nspr"
"--with-nspr-libs=${nspr.out}/lib"
"--with-nss-includes=${nss.dev}/include/nss"
"--with-nss-libs=${nss.out}/lib"
"--with-ncurses-headers=${ncurses.dev}/include"
"--with-system-ssl-certs=${cacert}/etc/ssl/certs"
"--disable-meanwhile"
"--disable-nm"
"--disable-tcl"
"--disable-gevolution"
]
++ lib.optionals withCyrus_sasl [ "--enable-cyrus-sasl=yes" ]
++ lib.optionals withGnutls [ "--enable-gnutls=yes" "--enable-nss=no" ]
++ lib.optionals stdenv.isDarwin [ "--disable-gtkspell" "--disable-vv" ];
doInstallCheck = stdenv.hostPlatform == stdenv.buildPlatform;
# In particular, this detects missing python imports in some of the tools.
postFixup = let
# TODO: python is a script, so it doesn't work as interpreter on darwin
binsToTest = lib.optionalString stdenv.isLinux "purple-remote," + "pidgin,finch";
in lib.optionalString doInstallCheck ''
for f in "''${!outputBin}"/bin/{${binsToTest}}; do
echo "Testing: $f --help"
"$f" --help
done
'';
enableParallelBuilding = true;
passthru = {
makePluginPath = lib.makeSearchPathOutput "lib" "lib/purple-${lib.versions.major version}";
postInstall = ''
wrapProgram $out/bin/pidgin \
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0"
'';
doInstallCheck = stdenv.hostPlatform == stdenv.buildPlatform;
# In particular, this detects missing python imports in some of the tools.
postFixup = let
# TODO: python is a script, so it doesn't work as interpreter on darwin
binsToTest = lib.optionalString stdenv.isLinux "purple-remote," + "pidgin,finch";
in lib.optionalString doInstallCheck ''
for f in "''${!outputBin}"/bin/{${binsToTest}}; do
echo "Testing: $f --help"
"$f" --help
done
'';
passthru = {
makePluginPath = lib.makeSearchPathOutput "lib" "lib/purple-${lib.versions.major version}";
withPlugins = pluginfn: callPackage ./wrapper.nix {
plugins = pluginfn pidginPackages;
pidgin = unwrapped;
};
};
meta = {
description = "Multi-protocol instant messaging client";
homepage = "https://pidgin.im/";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.unix;
maintainers = [ lib.maintainers.lucasew ];
};
};
meta = with lib; {
description = "Multi-protocol instant messaging client";
homepage = "https://pidgin.im/";
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = [ ];
};
};
in if plugins == [] then unwrapped
else callPackage ./wrapper.nix {
inherit plugins;
pidgin = unwrapped;
}
else unwrapped.withPlugins (_: plugins)

View file

@ -0,0 +1,70 @@
{ lib
, newScope
, pidgin
, texlive
, config
}:
lib.makeScope newScope (self:
let callPackage = self.callPackage;
in {
pidgin = callPackage ../. {
withOpenssl = config.pidgin.openssl or true;
withGnutls = config.pidgin.gnutls or false;
plugins = [];
};
pidginPackages = self;
pidgin-indicator = callPackage ./pidgin-indicator { };
pidgin-latex = callPackage ./pidgin-latex {
texLive = texlive.combined.scheme-basic;
};
pidgin-msn-pecan = callPackage ./msn-pecan { };
pidgin-mra = callPackage ./pidgin-mra { };
pidgin-skypeweb = callPackage ./pidgin-skypeweb { };
pidgin-carbons = callPackage ./carbons { };
pidgin-xmpp-receipts = callPackage ./pidgin-xmpp-receipts { };
pidgin-otr = callPackage ./otr { };
pidgin-osd = callPackage ./pidgin-osd { };
pidgin-sipe = callPackage ./sipe { };
pidgin-window-merge = callPackage ./window-merge { };
purple-discord = callPackage ./purple-discord { };
purple-googlechat = callPackage ./purple-googlechat { };
purple-hangouts = callPackage ./purple-hangouts { };
purple-lurch = callPackage ./purple-lurch { };
purple-matrix = callPackage ./purple-matrix { };
purple-mm-sms = callPackage ./purple-mm-sms { };
purple-plugin-pack = callPackage ./purple-plugin-pack { };
purple-signald = callPackage ./purple-signald { };
purple-slack = callPackage ./purple-slack { };
purple-vk-plugin = callPackage ./purple-vk-plugin { };
purple-xmpp-http-upload = callPackage ./purple-xmpp-http-upload { };
tdlib-purple = callPackage ./tdlib-purple { };
pidgin-opensteamworks = callPackage ./pidgin-opensteamworks { };
purple-facebook = callPackage ./purple-facebook { };
})

View file

@ -2015,4 +2015,32 @@ mapAliases ({
sddm
;
inherit (pidginPackages)
pidgin-indicator
pidgin-latex
pidgin-msn-pecan
pidgin-mra
pidgin-skypeweb
pidgin-carbons
pidgin-xmpp-receipts
pidgin-otr
pidgin-osd
pidgin-sipe
pidgin-window-merge
purple-discord
purple-googlechat
purple-hangouts
purple-lurch
purple-matrix
purple-mm-sms
purple-plugin-pack
purple-signald
purple-slack
purple-vk-plugin
purple-xmpp-http-upload
tdlib-purple
pidgin-opensteamworks
purple-facebook
;
})

View file

@ -34128,68 +34128,14 @@ with pkgs;
picosnitch = callPackage ../tools/networking/picosnitch { };
pidgin = callPackage ../applications/networking/instant-messengers/pidgin {
withOpenssl = config.pidgin.openssl or true;
withGnutls = config.pidgin.gnutls or false;
plugins = [];
};
pidginPackages = recurseIntoAttrs (callPackage ../applications/networking/instant-messengers/pidgin/pidgin-plugins { });
pidgin-indicator = callPackage ../applications/networking/instant-messengers/pidgin-plugins/pidgin-indicator { };
pidgin-latex = callPackage ../applications/networking/instant-messengers/pidgin-plugins/pidgin-latex {
texLive = texlive.combined.scheme-basic;
};
pidgin-msn-pecan = callPackage ../applications/networking/instant-messengers/pidgin-plugins/msn-pecan { };
pidgin-mra = callPackage ../applications/networking/instant-messengers/pidgin-plugins/pidgin-mra { };
pidgin-skypeweb = callPackage ../applications/networking/instant-messengers/pidgin-plugins/pidgin-skypeweb { };
pidgin-carbons = callPackage ../applications/networking/instant-messengers/pidgin-plugins/carbons { };
pidgin-xmpp-receipts = callPackage ../applications/networking/instant-messengers/pidgin-plugins/pidgin-xmpp-receipts { };
pidgin-otr = callPackage ../applications/networking/instant-messengers/pidgin-plugins/otr { };
pidgin-osd = callPackage ../applications/networking/instant-messengers/pidgin-plugins/pidgin-osd { };
pidgin-sipe = callPackage ../applications/networking/instant-messengers/pidgin-plugins/sipe { };
pidgin-window-merge = callPackage ../applications/networking/instant-messengers/pidgin-plugins/window-merge { };
inherit (pidginPackages) pidgin;
pika-backup = callPackage ../applications/backup/pika-backup { };
pur = callPackage ../development/tools/pur { };
purple-discord = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-discord { };
purple-googlechat = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-googlechat { };
purple-hangouts = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-hangouts { };
purple-lurch = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-lurch { };
purple-matrix = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-matrix { };
purple-mm-sms = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-mm-sms { };
purple-plugin-pack = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-plugin-pack { };
purple-signald = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-signald { };
purple-slack = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-slack { };
purple-vk-plugin = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-vk-plugin { };
purple-xmpp-http-upload = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-xmpp-http-upload { };
tdlib-purple = callPackage ../applications/networking/instant-messengers/pidgin-plugins/tdlib-purple { };
pidgin-opensteamworks = callPackage ../applications/networking/instant-messengers/pidgin-plugins/pidgin-opensteamworks { };
purple-facebook = callPackage ../applications/networking/instant-messengers/pidgin-plugins/purple-facebook { };
purpur = callPackage ../games/purpur { };
pikopixel = callPackage ../applications/graphics/pikopixel { };