at 22.05-pre 1.7 kB view raw
1{ lib 2, buildPythonPackage 3, fetchPypi 4, jsonschema 5, jxmlease 6, ncclient 7, netaddr 8, paramiko 9, pynetbox 10, scp 11, textfsm 12, ttp 13, xmltodict 14, withJunos ? false 15, withNetbox ? false 16 17, version 18, sha256 19}: 20 21buildPythonPackage rec { 22 pname = "ansible"; 23 inherit version; 24 format = "setuptools"; 25 26 src = fetchPypi { 27 inherit pname version sha256; 28 }; 29 30 postPatch = '' 31 # make ansible-base depend on ansible-collection, not the other way around 32 sed -Ei '/ansible-(base|core)/d' setup.py 33 ''; 34 35 propagatedBuildInputs = lib.unique ([ 36 # Support ansible collections by default, make all others optional 37 # ansible.netcommon 38 jxmlease 39 ncclient 40 netaddr 41 paramiko 42 xmltodict 43 # ansible.posix 44 # ansible.utils 45 jsonschema 46 textfsm 47 ttp 48 xmltodict 49 # ansible.windows 50 51 # lots of collections with dedicated requirements.txt and pyproject.toml files, 52 # add the dependencies for the collections you need conditionally and install 53 # ansible using overrides to enable the collections you need. 54 ] ++ lib.optionals (withJunos) [ 55 # ansible_collections/junipernetworks/junos/requirements.txt 56 jxmlease 57 ncclient 58 paramiko 59 scp 60 xmltodict 61 ] ++ lib.optionals (withNetbox) [ 62 # ansible_collections/netbox/netbox/pyproject.toml 63 pynetbox 64 ]); 65 66 # don't try and fail to strip 48000+ non strippable files, it takes >5 minutes! 67 dontStrip = true; 68 69 # difficult to test 70 doCheck = false; 71 72 meta = with lib; { 73 description = "Radically simple IT automation"; 74 homepage = "https://www.ansible.com"; 75 license = licenses.gpl3Plus; 76 maintainers = with maintainers; [ hexa ]; 77 }; 78}