about summary refs log tree commit diff
path: root/pkgs/applications/networking/irc/weechat
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/networking/irc/weechat')
-rw-r--r--pkgs/applications/networking/irc/weechat/default.nix6
-rw-r--r--pkgs/applications/networking/irc/weechat/scripts/default.nix12
-rw-r--r--pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix6
-rw-r--r--pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix64
-rw-r--r--pkgs/applications/networking/irc/weechat/scripts/weechat-otr/libpath.patch13
-rw-r--r--pkgs/applications/networking/irc/weechat/scripts/weechat-xmpp/default.nix36
-rw-r--r--pkgs/applications/networking/irc/weechat/scripts/weechat-xmpp/libpath.patch16
-rw-r--r--pkgs/applications/networking/irc/weechat/wrapper.nix6
8 files changed, 90 insertions, 69 deletions
diff --git a/pkgs/applications/networking/irc/weechat/default.nix b/pkgs/applications/networking/irc/weechat/default.nix
index 3f8ad762218c..31f2a7e6a276 100644
--- a/pkgs/applications/networking/irc/weechat/default.nix
+++ b/pkgs/applications/networking/irc/weechat/default.nix
@@ -6,21 +6,21 @@
 , guileSupport ? true, guile
 , luaSupport ? true, lua5
 , perlSupport ? true, perl
-, pythonSupport ? true, pythonPackages
+, pythonSupport ? true, python3Packages
 , rubySupport ? true, ruby
 , tclSupport ? true, tcl
 , extraBuildInputs ? []
 }:
 
 let
-  inherit (pythonPackages) python;
+  inherit (python3Packages) python;
   plugins = [
     { name = "perl"; enabled = perlSupport; cmakeFlag = "ENABLE_PERL"; buildInputs = [ perl ]; }
     { name = "tcl"; enabled = tclSupport; cmakeFlag = "ENABLE_TCL"; buildInputs = [ tcl ]; }
     { name = "ruby"; enabled = rubySupport; cmakeFlag = "ENABLE_RUBY"; buildInputs = [ ruby ]; }
     { name = "guile"; enabled = guileSupport; cmakeFlag = "ENABLE_GUILE"; buildInputs = [ guile ]; }
     { name = "lua"; enabled = luaSupport; cmakeFlag = "ENABLE_LUA"; buildInputs = [ lua5 ]; }
-    { name = "python"; enabled = pythonSupport; cmakeFlag = "ENABLE_PYTHON"; buildInputs = [ python ]; }
+    { name = "python"; enabled = pythonSupport; cmakeFlag = "ENABLE_PYTHON3"; buildInputs = [ python ]; }
   ];
   enabledPlugins = builtins.filter (p: p.enabled) plugins;
 
diff --git a/pkgs/applications/networking/irc/weechat/scripts/default.nix b/pkgs/applications/networking/irc/weechat/scripts/default.nix
index cd9ecbf43370..81ee484f3b30 100644
--- a/pkgs/applications/networking/irc/weechat/scripts/default.nix
+++ b/pkgs/applications/networking/irc/weechat/scripts/default.nix
@@ -1,17 +1,13 @@
-{ callPackage, luaPackages, pythonPackages }:
+{ callPackage, luaPackages }:
 
 {
-  weechat-xmpp = callPackage ./weechat-xmpp {
-    inherit (pythonPackages) pydns;
-  };
-
   weechat-matrix-bridge = callPackage ./weechat-matrix-bridge {
     inherit (luaPackages) cjson luaffi;
   };
 
-  wee-slack = callPackage ./wee-slack {
-    inherit pythonPackages;
-  };
+  wee-slack = callPackage ./wee-slack { };
 
   weechat-autosort = callPackage ./weechat-autosort { };
+
+  weechat-otr = callPackage ./weechat-otr { };
 }
diff --git a/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix b/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix
index 49616671507d..6811cb164e0e 100644
--- a/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix
+++ b/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, substituteAll, buildEnv, fetchFromGitHub, pythonPackages }:
+{ stdenv, substituteAll, buildEnv, fetchFromGitHub, python3Packages }:
 
 stdenv.mkDerivation rec {
   pname = "wee-slack";
@@ -16,8 +16,8 @@ stdenv.mkDerivation rec {
       src = ./libpath.patch;
       env = "${buildEnv {
         name = "wee-slack-env";
-        paths = with pythonPackages; [ websocket_client six ];
-      }}/${pythonPackages.python.sitePackages}";
+        paths = with python3Packages; [ websocket_client six ];
+      }}/${python3Packages.python.sitePackages}";
     })
   ];
 
diff --git a/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix b/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix
new file mode 100644
index 000000000000..9682aa3169ac
--- /dev/null
+++ b/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, substituteAll, buildEnv, fetchgit, fetchFromGitHub, python3Packages, gmp }:
+
+let
+  # pure-python-otr (potr) requires an older version of pycrypto, which is
+  # not compatible with pycryptodome. Therefore, the latest patched version
+  # of pycrypto will be fetched from the Debian project.
+  # https://security-tracker.debian.org/tracker/source-package/python-crypto
+
+  pycrypto = python3Packages.buildPythonPackage rec {
+    pname = "pycrypto";
+    version = "2.6.1-10";
+
+    src = fetchgit {
+      url = "https://salsa.debian.org/sramacher/python-crypto.git";
+      rev = "debian/${version}";
+      sha256 = "10rgq8bmjfpiqqa1g1p1hh7pxlxs7x0nawvk6zip0pd6x2vsr661";
+    };
+
+    buildInputs = [ gmp ];
+
+    preConfigure = ''
+      sed -i 's,/usr/include,/no-such-dir,' configure
+      sed -i "s!,'/usr/include/'!!" setup.py
+    '';
+  };
+
+  potr = python3Packages.potr.overridePythonAttrs (oldAttrs: {
+    propagatedBuildInputs = [ pycrypto ];
+  });
+in stdenv.mkDerivation rec {
+  pname = "weechat-otr";
+  version = "1.9.2";
+
+  src = fetchFromGitHub {
+    repo = pname;
+    owner = "mmb";
+    rev = "v${version}";
+    sha256 = "1lngv98y6883vk8z2628cl4d5y8jxy39w8245gjdvshl8g18k5s2";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./libpath.patch;
+      env = "${buildEnv {
+        name = "weechat-otr-env";
+        paths = [ potr pycrypto ];
+      }}/${python3Packages.python.sitePackages}";
+    })
+  ];
+
+  passthru.scripts = [ "weechat_otr.py" ];
+
+  installPhase = ''
+    mkdir -p $out/share
+    cp weechat_otr.py $out/share/weechat_otr.py
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/mmb/weechat-otr";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ geistesk ];
+    description = "WeeChat script for Off-the-Record messaging";
+  };
+}
diff --git a/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/libpath.patch b/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/libpath.patch
new file mode 100644
index 000000000000..a7b77ed9b602
--- /dev/null
+++ b/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/libpath.patch
@@ -0,0 +1,13 @@
+diff --git a/weechat_otr.py b/weechat_otr.py
+index 0ccfb35..c42bebf 100644
+--- a/weechat_otr.py
++++ b/weechat_otr.py
+@@ -41,6 +41,8 @@ import shlex
+ import shutil
+ import sys
+ 
++sys.path.append('@env@')
++
+ import potr
+ import weechat
+ 
diff --git a/pkgs/applications/networking/irc/weechat/scripts/weechat-xmpp/default.nix b/pkgs/applications/networking/irc/weechat/scripts/weechat-xmpp/default.nix
deleted file mode 100644
index dad5b9c5e02a..000000000000
--- a/pkgs/applications/networking/irc/weechat/scripts/weechat-xmpp/default.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-{ stdenv, fetchFromGitHub, xmpppy, pydns, substituteAll, buildEnv }:
-
-stdenv.mkDerivation {
-  name = "weechat-jabber-2017-08-30";
-
-  src = fetchFromGitHub {
-    repo = "weechat-xmpp";
-    owner = "sleduc";
-    sha256 = "0s02xs0ynld9cxxzj07al364sfglyc5ir1i82133mq0s8cpphnxv";
-    rev = "8f6c21f5a160c9318c7a2d8fd5dcac7ab2e0d843";
-  };
-
-  installPhase = ''
-    mkdir -p $out/share
-    cp jabber.py $out/share/jabber.py
-  '';
-
-  patches = [
-    (substituteAll {
-      src = ./libpath.patch;
-      env = "${buildEnv {
-        name = "weechat-xmpp-env";
-        paths = [ pydns xmpppy ];
-      }}/lib/python2.7/site-packages";
-    })
-  ];
-
-  passthru.scripts = [ "jabber.py" ];
-
-  meta = with stdenv.lib; {
-    description = "A fork of the jabber plugin for weechat";
-    homepage = "https://github.com/sleduc/weechat-xmpp";
-    maintainers = with maintainers; [ ma27 ];
-    license = licenses.gpl3Plus;
-  };
-}
diff --git a/pkgs/applications/networking/irc/weechat/scripts/weechat-xmpp/libpath.patch b/pkgs/applications/networking/irc/weechat/scripts/weechat-xmpp/libpath.patch
deleted file mode 100644
index 372c83944a27..000000000000
--- a/pkgs/applications/networking/irc/weechat/scripts/weechat-xmpp/libpath.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git a/jabber.py b/jabber.py
-index 27006a3..e53c2c0 100644
---- a/jabber.py
-+++ b/jabber.py
-@@ -95,6 +95,11 @@ SCRIPT_COMMAND = SCRIPT_NAME
- import re
- import warnings
- 
-+import sys
-+
-+sys.path.append('@env@')
-+
-+
- import_ok = True
- 
- try:
diff --git a/pkgs/applications/networking/irc/weechat/wrapper.nix b/pkgs/applications/networking/irc/weechat/wrapper.nix
index e6fa95488e10..5c06bb8517a2 100644
--- a/pkgs/applications/networking/irc/weechat/wrapper.nix
+++ b/pkgs/applications/networking/irc/weechat/wrapper.nix
@@ -1,5 +1,5 @@
 { lib, runCommand, writeScriptBin, buildEnv
-, pythonPackages, perlPackages, runtimeShell
+, python3Packages, perlPackages, runtimeShell
 }:
 
 weechat:
@@ -17,11 +17,11 @@ let
       in rec {
         python = (simplePlugin "python") // {
           extraEnv = ''
-            export PATH="${pythonPackages.python}/bin:$PATH"
+            export PATH="${python3Packages.python}/bin:$PATH"
           '';
           withPackages = pkgsFun: (python // {
             extraEnv = ''
-              export PYTHONHOME="${pythonPackages.python.withPackages pkgsFun}"
+              export PYTHONHOME="${python3Packages.python.withPackages pkgsFun}"
             '';
           });
         };