nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, buildPythonPackage
4, fetchFromGitHub
5, fetchpatch
6, jinja2
7, poetry-core
8, pytestCheckHook
9, pythonOlder
10, pyyaml
11, toml
12}:
13
14buildPythonPackage rec {
15 pname = "netutils";
16 version = "1.1.0";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "networktocode";
23 repo = pname;
24 rev = "v${version}";
25 hash = "sha256-rTSesG7XmIzu2DcJMVgZMlh0kRQ8jEB3t++rgf63Flw=";
26 };
27
28 nativeBuildInputs = [
29 poetry-core
30 ];
31
32 checkInputs = [
33 jinja2
34 pytestCheckHook
35 pyyaml
36 toml
37 ];
38
39 patches = [
40 # Switch to poetry-core, https://github.com/networktocode/netutils/pull/115
41 (fetchpatch {
42 name = "switch-to-poetry-core.patch";
43 url = "https://github.com/networktocode/netutils/commit/edc8b06686db4e5b4c8c4deb6d0effbc22177b31.patch";
44 sha256 = "sha256-K5oSbtOJYeKbxzbaZQBXcl6LsHQAK8CxBLfkak15V6M=";
45 })
46 ];
47
48 pythonImportsCheck = [
49 "netutils"
50 ];
51
52 disabledTests = [
53 # Tests require network access
54 "test_is_fqdn_resolvable"
55 "test_fqdn_to_ip"
56 "test_tcp_ping"
57 # Skip SPhinx test
58 "test_sphinx_build"
59 ];
60
61 meta = with lib; {
62 broken = stdenv.isDarwin;
63 description = "Library that is a collection of objects for common network automation tasks";
64 homepage = "https://github.com/networktocode/netutils";
65 license = licenses.asl20;
66 maintainers = with maintainers; [ fab ];
67 };
68}