1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 runCommand,
6 wireshark-cli,
7 pytestCheckHook,
8 manuf, # remove when buildPythonPackage supports finalAttrs
9}:
10
11buildPythonPackage rec {
12 pname = "manuf";
13 version = "1.1.5";
14 format = "setuptools";
15
16 src = fetchFromGitHub {
17 owner = "coolbho3k";
18 repo = "manuf";
19 rev = "${version}";
20 hash = "sha256-3CFs3aqwE8rZPwU1QBqAGxNHT5jg7ymG12yBD56gTNI=";
21 };
22
23 nativeBuildInputs = [ wireshark-cli ];
24
25 patches = [
26 # Do update while building package from wireshark-cli
27 ./internal_db_update_nix.patch
28 # Fix MANUF_URL for external db update functionality (https://github.com/coolbho3k/manuf/issues/34)
29 ./fix_manuf_url.patch
30 ];
31
32 postPatch = ''
33 ${lib.getExe wireshark-cli} -G manuf > manuf/manuf
34 cat ${wireshark-cli}/share/wireshark/wka >> manuf/manuf
35 '';
36
37 nativeCheckInputs = [ pytestCheckHook ];
38
39 disabledTests = [ "test_update_update" ];
40
41 pythonImportsCheck = [ "manuf" ];
42
43 passthru.tests = {
44 testMacAddress = runCommand "${pname}-test" { } ''
45 ${lib.getExe manuf} BC:EE:7B:00:00:00 > $out
46 [ "$(cat $out | tr -d '\n')" = "Vendor(manuf='ASUSTekC', manuf_long='ASUSTek COMPUTER INC.', comment=None)" ]
47 '';
48 };
49
50 meta = with lib; {
51 homepage = "https://github.com/coolbho3k/manuf";
52 description = "Parser library for Wireshark's OUI database";
53 mainProgram = "manuf";
54 platforms = platforms.linux;
55 license = with licenses; [
56 lgpl3Plus
57 asl20
58 ];
59 maintainers = with maintainers; [ dsuetin ];
60 };
61}