Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 replaceVars, 5 buildEnv, 6 fetchgit, 7 fetchFromGitHub, 8 python3Packages, 9 gmp, 10}: 11 12let 13 # pure-python-otr (potr) requires an older version of pycrypto, which is 14 # not compatible with pycryptodome. Therefore, the latest patched version 15 # of pycrypto will be fetched from the Debian project. 16 # https://security-tracker.debian.org/tracker/source-package/python-crypto 17 18 pycrypto = python3Packages.buildPythonPackage rec { 19 pname = "pycrypto"; 20 version = "2.6.1-13.1"; 21 format = "setuptools"; 22 23 src = fetchgit { 24 url = "https://salsa.debian.org/sramacher/python-crypto.git"; 25 rev = "debian/${version}"; 26 sha256 = "1mahqmlgilgk0rn5hfkhza7kscfm7agdakkb6rqnif9g0qp3s52f"; 27 }; 28 29 postPatch = '' 30 for p in debian/patches/*.patch; do 31 patch -p1 < "$p" 32 done 33 ''; 34 35 buildInputs = [ gmp ]; 36 37 # Tests are relying on old Python 2 modules. 38 doCheck = false; 39 40 preConfigure = '' 41 sed -i 's,/usr/include,/no-such-dir,' configure 42 sed -i "s!,'/usr/include/'!!" setup.py 43 ''; 44 }; 45 46 potr = python3Packages.potr.overridePythonAttrs (oldAttrs: { 47 propagatedBuildInputs = [ pycrypto ]; 48 }); 49in 50stdenv.mkDerivation rec { 51 pname = "weechat-otr"; 52 version = "1.9.2"; 53 54 src = fetchFromGitHub { 55 repo = pname; 56 owner = "mmb"; 57 rev = "v${version}"; 58 sha256 = "1lngv98y6883vk8z2628cl4d5y8jxy39w8245gjdvshl8g18k5s2"; 59 }; 60 61 patches = [ 62 (replaceVars ./libpath.patch { 63 env = "${ 64 buildEnv { 65 name = "weechat-otr-env"; 66 paths = [ 67 potr 68 pycrypto 69 ]; 70 } 71 }/${python3Packages.python.sitePackages}"; 72 }) 73 ]; 74 75 passthru.scripts = [ "weechat_otr.py" ]; 76 77 installPhase = '' 78 mkdir -p $out/share 79 cp weechat_otr.py $out/share/weechat_otr.py 80 ''; 81 82 meta = with lib; { 83 homepage = "https://github.com/mmb/weechat-otr"; 84 license = licenses.gpl3; 85 maintainers = with maintainers; [ oxzi ]; 86 description = "WeeChat script for Off-the-Record messaging"; 87 knownVulnerabilities = [ 88 "There is no upstream release since 2018-03." 89 "Utilizes deprecated and vulnerable pycrypto library with Debian patches from 2020-04." 90 ]; 91 }; 92}