summary refs log tree commit diff
diff options
context:
space:
mode:
authorgeistesk <github.jyf300hj@0x21.biz>2019-06-05 23:47:43 +0200
committergeistesk <github.jyf300hj@0x21.biz>2019-09-02 11:28:58 +0200
commitd81e7bdf45e6bdd62ab25b6984c4cf3ef13b7e6c (patch)
tree9c2fff8dde3db38f69602db693f858db80385854
parent57507ca0b1e6686168427750f4989300b5a95e7c (diff)
downloadnixpkgs-d81e7bdf45e6bdd62ab25b6984c4cf3ef13b7e6c.tar
nixpkgs-d81e7bdf45e6bdd62ab25b6984c4cf3ef13b7e6c.tar.gz
nixpkgs-d81e7bdf45e6bdd62ab25b6984c4cf3ef13b7e6c.tar.bz2
nixpkgs-d81e7bdf45e6bdd62ab25b6984c4cf3ef13b7e6c.tar.lz
nixpkgs-d81e7bdf45e6bdd62ab25b6984c4cf3ef13b7e6c.tar.xz
nixpkgs-d81e7bdf45e6bdd62ab25b6984c4cf3ef13b7e6c.tar.zst
nixpkgs-d81e7bdf45e6bdd62ab25b6984c4cf3ef13b7e6c.zip
weechatScripts.weechat-otr: init at 1.9.2
-rw-r--r--pkgs/applications/networking/irc/weechat/scripts/default.nix4
-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
3 files changed, 81 insertions, 0 deletions
diff --git a/pkgs/applications/networking/irc/weechat/scripts/default.nix b/pkgs/applications/networking/irc/weechat/scripts/default.nix
index 439e0e11614..845833d8a50 100644
--- a/pkgs/applications/networking/irc/weechat/scripts/default.nix
+++ b/pkgs/applications/networking/irc/weechat/scripts/default.nix
@@ -14,4 +14,8 @@
   };
 
   weechat-autosort = callPackage ./weechat-autosort { };
+
+  weechat-otr = callPackage ./weechat-otr {
+    inherit pythonPackages;
+  };
 }
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 00000000000..c22903c0ece
--- /dev/null
+++ b/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, substituteAll, buildEnv, fetchgit, fetchFromGitHub, pythonPackages, 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 = pythonPackages.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 = pythonPackages.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 ];
+      }}/${pythonPackages.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 00000000000..a7b77ed9b60
--- /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
+