From e3cb9e5e5f343d13cbbdc87b6fd1abc1103156ae Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 6 Jan 2014 14:36:53 +0100 Subject: [PATCH] tkabber: Merge main package with site plugins. The site plugins are released alongside the main Tkabber sources, so it makes no sense to have them in a separate package (which also introduces an impurity). In addition, both packages share the same makefile structure, so it really makes sense to merge them. Before people might get worried about my decision to enable those plugins by default: Since version 1.0, Tkabber is no longer loading _all_ available plugins, but gives you a menu (Plugins Management) to selectively enable plugins (whereas all plugins are disabled by default). Signed-off-by: aszlig --- .../tkabber-plugins/default.nix | 21 -------- .../instant-messengers/tkabber/default.nix | 50 +++++++++++++------ pkgs/top-level/all-packages.nix | 2 - 3 files changed, 34 insertions(+), 39 deletions(-) delete mode 100644 pkgs/applications/networking/instant-messengers/tkabber-plugins/default.nix diff --git a/pkgs/applications/networking/instant-messengers/tkabber-plugins/default.nix b/pkgs/applications/networking/instant-messengers/tkabber-plugins/default.nix deleted file mode 100644 index bb5d0b1c76bf..000000000000 --- a/pkgs/applications/networking/instant-messengers/tkabber-plugins/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ stdenv, fetchurl }: - -stdenv.mkDerivation rec { - name = "tkabber-plugins-${version}"; - version = "1.0"; - - src = fetchurl { - url = "http://files.jabber.ru/tkabber/tkabber-plugins-${version}.tar.xz"; - sha256 = "d61251dc664f0bfa8534e578096dede9a7bb7d4f2620489f8d2c43d36cd61ba9"; - }; - - configurePhase = '' - sed -e "s@/usr/local@$out@" -i Makefile - ''; - - meta = { - homepage = "http://tkabber.jabber.ru/tkabber-plugins"; - description = "Plugins for the Tkabber instant messenger"; - license = stdenv.lib.licenses.gpl2; - }; -} diff --git a/pkgs/applications/networking/instant-messengers/tkabber/default.nix b/pkgs/applications/networking/instant-messengers/tkabber/default.nix index 79c3d3d32ccd..8b6b3893311e 100644 --- a/pkgs/applications/networking/instant-messengers/tkabber/default.nix +++ b/pkgs/applications/networking/instant-messengers/tkabber/default.nix @@ -1,9 +1,24 @@ { stdenv, fetchurl, tcl, tk, tcllib, tcltls, tclgpg , bwidget, makeWrapper, x11 +, withSitePlugins ? true , theme ? null }: +with stdenv.lib; + let + version = "1.0"; + + main = { + name = "tkabber"; + sha256 = "49ee6e897dfe52ebac256531b54955e6b39223f606a9b8ad63a52475389db206"; + }; + + plugins = { + name = "tkabber-plugins"; + sha256 = "d61251dc664f0bfa8534e578096dede9a7bb7d4f2620489f8d2c43d36cd61ba9"; + }; + tclLibraries = [ bwidget tcllib tcltls tclgpg ]; getTclLibPath = p: "${p}/lib/${p.libPrefix}"; @@ -11,36 +26,39 @@ let tclLibPaths = stdenv.lib.concatStringsSep " " (map getTclLibPath tclLibraries); -in stdenv.mkDerivation rec { - name = "tkabber-1.0"; + mkTkabber = attrs: stdenv.mkDerivation (rec { + name = "${attrs.name}-${version}"; - src = fetchurl { - url = "http://files.jabber.ru/tkabber/${name}.tar.xz"; - sha256 = "49ee6e897dfe52ebac256531b54955e6b39223f606a9b8ad63a52475389db206"; - }; + src = fetchurl { + url = "http://files.jabber.ru/tkabber/${name}.tar.xz"; + inherit (attrs) sha256; + }; - patchPhase = '' + prePatch = '' + sed -e "s@/usr/local@$out@" -i Makefile + ''; + } // removeAttrs attrs [ "name" "sha256" ]); + +in mkTkabber (main // { + postPatch = '' substituteInPlace login.tcl --replace \ "custom::defvar loginconf(sslcacertstore) \"\"" \ "custom::defvar loginconf(sslcacertstore) \$env(OPENSSL_X509_CERT_FILE)" - '' + stdenv.lib.optionalString (theme != null) '' + '' + optionalString (theme != null) '' themePath="$out/share/doc/tkabber/examples/xrdb/${theme}.xrdb" sed -i '/^if.*load_default_xrdb/,/^}$/ { s@option readfile \(\[fullpath [^]]*\]\)@option readfile "'"$themePath"'"@ }' tkabber.tcl ''; - configurePhase = '' - mkdir -p $out/bin - sed -e "s@/usr/local@$out@" -i Makefile - ''; - postInstall = '' for prog in $out/bin/*; do wrapProgram "$prog" \ --prefix PATH : "${tk}/bin" \ --set TCLLIBPATH '"${tclLibPaths}"' \ - --set TKABBER_SITE_PLUGINS '$HOME/.nix-profile/share/tkabber-plugins' + ${optionalString withSitePlugins '' + --set TKABBER_SITE_PLUGINS '${mkTkabber plugins}/share/tkabber-plugins' + ''} done ''; @@ -48,7 +66,7 @@ in stdenv.mkDerivation rec { meta = { homepage = "http://tkabber.jabber.ru/"; - description = "A GUI client for the XMPP (Jabber) instant messaging protocol"; + description = "A GUI XMPP (Jabber) client written in Tcl/Tk"; license = stdenv.lib.licenses.gpl2; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1847540f8230..e839833ee28c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2065,8 +2065,6 @@ let tkabber = callPackage ../applications/networking/instant-messengers/tkabber { }; - tkabber_plugins = callPackage ../applications/networking/instant-messengers/tkabber-plugins { }; - qfsm = callPackage ../applications/science/electronics/qfsm { }; tkgate = callPackage ../applications/science/electronics/tkgate/1.x.nix {