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