Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weechatScripts.weechat-otr: init at 1.9.2 #62743

Merged
merged 1 commit into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/applications/networking/irc/weechat/scripts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@
};

weechat-autosort = callPackage ./weechat-autosort { };

weechat-otr = callPackage ./weechat-otr {
inherit pythonPackages;
};
}
Original file line number Diff line number Diff line change
@@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bit nitpicky but might look nicer with a line break somewhere round here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a style guide for this. Scrolling through nixpkgs' manual brought up another in stdenv.mkDerivation in the same line. The let example in nix's manual does also continues on the same line.

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";
};
}
Original file line number Diff line number Diff line change
@@ -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