about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/ansible/collections.nix
blob: 05aa0b2b2945dd3bf7d6a8ae36e86fa50d05b8b5 (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
68
69
70
71
72
73
74
75
76
77
78
79
{ lib
, buildPythonPackage
, fetchPypi
, ansible-base
, jsonschema
, jxmlease
, ncclient
, netaddr
, paramiko
, pynetbox
, scp
, textfsm
, ttp
, xmltodict
, withJunos ? false
, withNetbox ? false

, version
, sha256
}:

buildPythonPackage rec {
  pname = "ansible";
  inherit version;
  format = "setuptools";

  src = fetchPypi {
    inherit pname version sha256;
  };

  postPatch = ''
    # make ansible-base depend on ansible-collection, not the other way around
    sed -Ei '/ansible-(base|core)/d' setup.py
  '';

  propagatedBuildInputs = lib.unique ([
    # Support ansible collections by default, make all others optional
    # ansible.netcommon
    jxmlease
    ncclient
    netaddr
    paramiko
    xmltodict
    # ansible.posix
    # ansible.utils
    jsonschema
    textfsm
    ttp
    xmltodict
    # ansible.windows

    # lots of collections with dedicated requirements.txt and pyproject.toml files,
    # add the dependencies for the collections you need conditionally and install
    # ansible using overrides to enable the collections you need.
  ] ++ lib.optionals (withJunos) [
    # ansible_collections/junipernetworks/junos/requirements.txt
    jxmlease
    ncclient
    paramiko
    scp
    xmltodict
  ] ++ lib.optionals (withNetbox) [
    # ansible_collections/netbox/netbox/pyproject.toml
    pynetbox
  ]);

  # don't try and fail to strip 48000+ non strippable files, it takes >5 minutes!
  dontStrip = true;

  # difficult to test
  doCheck = false;

  meta = with lib; {
    description = "Radically simple IT automation";
    homepage = "http://www.ansible.com";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ hexa ];
  };
}