1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 substituteAll, 6 nmap, 7 python, 8}: 9 10buildPythonPackage rec { 11 pname = "netmap"; 12 version = "0.7.0.2"; 13 format = "setuptools"; 14 15 src = fetchFromGitHub { 16 owner = "home-assistant-libs"; 17 repo = "python-nmap"; 18 rev = version; 19 sha256 = "1a44zz9zsxy48ahlpjjrddpyfi7cnfknicfcp35hi588qm430mag"; 20 }; 21 22 patches = [ 23 (substituteAll { 24 src = ./nmap-path.patch; 25 nmap = "${lib.getBin nmap}/bin/nmap"; 26 }) 27 ]; 28 29 # upstream tests require sudo 30 # make sure nmap is found instead 31 checkPhase = '' 32 runHook preCheck 33 ${python.interpreter} -c 'import nmap; nmap.PortScanner()' 34 runHook postCheck 35 ''; 36 37 pythonImportsCheck = [ "nmap" ]; 38 39 meta = with lib; { 40 description = "Python class to use nmap and access scan results from python3"; 41 homepage = "https://github.com/home-assistant-libs/python-nmap"; 42 license = licenses.gpl3Plus; 43 maintainers = with maintainers; [ dotlambda ]; 44 }; 45}