summary refs log tree commit diff
path: root/pkgs/development/python-modules/napalm/default.nix
blob: eabbadc1d6145cdcddf852b5aaa9ad1302adc06a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{ lib, buildPythonPackage, fetchFromGitHub, fetchpatch, setuptools, cffi
, paramiko, requests, future, textfsm, jinja2, netaddr, pyyaml, pyeapi, netmiko
, junos-eznc, ciscoconfparse, scp, lxml, ncclient, pytestCheckHook, ddt, mock
, pythonOlder, invoke }:

buildPythonPackage rec {
  pname = "napalm";
  version = "3.4.1";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "napalm-automation";
    repo = "napalm";
    rev = version;
    hash = "sha256-TNWRJtc6+VS6wgJGGvCPDoFQmOKQAyXdjFQo9bPJ2F8=";
  };

  patches = [
    # netmiko 4.0.0 support
    (fetchpatch{
      url = "https://github.com/napalm-automation/napalm/commit/4b8cc85db3236099a04f742cf71773e74d9dd70e.patch";
      excludes = [ "requirements.txt" ];
      hash = "sha256-DBKp+wiKd+/j2xAqaQL3UCcGQd6wnWcNTsNXBBt9c98=";
    })
    (fetchpatch{
      url = "https://github.com/napalm-automation/napalm/commit/4a8b5b1823335dd79aa5269c038a1f08ecd35cdd.patch";
      hash = "sha256-uiou/rzmnFf4wAvXwmUsGJx99GeHWKJB2JrMM1kLakM=";
    })
  ];

  postPatch = ''
    substituteInPlace requirements.txt \
      --replace "netmiko>=3.3.0,<4.0.0" "netmiko"
  '';

  propagatedBuildInputs = [
    cffi
    paramiko
    requests
    future
    textfsm
    invoke
    jinja2
    netaddr
    pyyaml
    pyeapi
    netmiko
    junos-eznc
    ciscoconfparse
    scp
    setuptools
    lxml
    ncclient
  ];

  nativeCheckInputs = [ pytestCheckHook mock ddt ];

  meta = with lib; {
    description =
      "Network Automation and Programmability Abstraction Layer with Multivendor support";
    homepage = "https://github.com/napalm-automation/napalm";
    license = licenses.asl20;
    maintainers = with maintainers; [ ] ++ teams.c3d2.members;
  };
}