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