Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 19.03 1.8 kB view raw
1{ buildPythonPackage, fetchFromGitHub, lib, isPyPy, isPy3k, pythonOlder 2, pycrypto, ecdsa # TODO 3, enum34, mock 4, withOptionalDeps ? true, tcpdump, ipython 5, withCryptography ? true, cryptography 6, withVoipSupport ? true, sox 7, withPlottingSupport ? true, matplotlib 8, withGraphicsSupport ? false, pyx, texlive, graphviz, imagemagick 9, withManufDb ? false, wireshark 10# 2D/3D graphics and graphs TODO: VPython 11# TODO: nmap, numpy 12}: 13 14buildPythonPackage rec { 15 pname = "scapy"; 16 version = "2.4.2"; 17 18 disabled = isPyPy; 19 20 src = fetchFromGitHub { 21 owner = "secdev"; 22 repo = "scapy"; 23 rev = "v${version}"; 24 sha256 = "03xzjklvc6y4d87k0rqpx5h112ld5nvgfldrbd8c4mx6f9mmd11n"; 25 }; 26 27 # TODO: Temporary workaround 28 patches = [ ./fix-version.patch ]; 29 30 postPatch = '' 31 sed -i "s/NIXPKGS_SCAPY_VERSION/${version}/" \ 32 setup.py scapy/__init__.py 33 '' + lib.optionalString withManufDb '' 34 substituteInPlace scapy/data.py --replace "/opt/wireshark" "${wireshark}" 35 ''; 36 37 propagatedBuildInputs = [ pycrypto ecdsa ] 38 ++ lib.optional withOptionalDeps [ tcpdump ipython ] 39 ++ lib.optional withCryptography [ cryptography ] 40 ++ lib.optional withVoipSupport [ sox ] 41 ++ lib.optional withPlottingSupport [ matplotlib ] 42 ++ lib.optional withGraphicsSupport [ pyx texlive.combined.scheme-minimal graphviz imagemagick ] 43 ++ lib.optional (isPy3k && pythonOlder "3.4") [ enum34 ] 44 ++ lib.optional doCheck [ mock ]; 45 46 # Tests fail with Python 3.6 (seems to be an upstream bug, I'll investigate) 47 doCheck = if isPy3k then false else true; 48 49 meta = with lib; { 50 description = "Powerful interactive network packet manipulation program"; 51 homepage = https://scapy.net/; 52 license = licenses.gpl2; 53 platforms = platforms.unix; 54 maintainers = with maintainers; [ primeos bjornfor ]; 55 }; 56}