1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 netbox,
7 pythonAtLeast,
8 napalm,
9}:
10buildPythonPackage rec {
11 pname = "netbox-napalm-plugin";
12 version = "0.3.1";
13 pyproject = true;
14
15 disabled = pythonAtLeast "3.13";
16
17 src = fetchFromGitHub {
18 owner = "netbox-community";
19 repo = "netbox-napalm-plugin";
20 rev = "v${version}";
21 hash = "sha256-nog6DymnnD0ABzG21jy00yNWhSTHfd7vJ4vo1DjsfKs=";
22 };
23
24 build-system = [ setuptools ];
25
26 dependencies = [ napalm ];
27
28 nativeCheckInputs = [ netbox ];
29
30 postPatch = ''
31 substituteInPlace pyproject.toml \
32 --replace-fail 'napalm<5.0' 'napalm'
33 '';
34
35 preFixup = ''
36 export PYTHONPATH=${netbox}/opt/netbox/netbox:$PYTHONPATH
37 '';
38
39 pythonImportsCheck = [ "netbox_napalm_plugin" ];
40
41 meta = {
42 description = "Netbox plugin for Napalm integration";
43 homepage = "https://github.com/netbox-community/netbox-napalm-plugin";
44 changelog = "https://github.com/netbox-community/netbox-napalm-plugin/releases/tag/${src.rev}";
45 license = lib.licenses.asl20;
46 platforms = lib.platforms.linux;
47 maintainers = with lib.maintainers; [ felbinger ];
48 };
49}