1{ lib
2, callPackage
3, buildPythonPackage
4, fetchPypi
5, installShellFiles
6, cryptography
7, jinja2
8, junit-xml
9, lxml
10, ncclient
11, packaging
12, paramiko
13, pexpect
14, psutil
15, pycrypto
16, pyyaml
17, requests
18, resolvelib
19, scp
20, windowsSupport ? false, pywinrm
21, xmltodict
22}:
23
24let
25 ansible-collections = callPackage ./collections.nix {
26 version = "4.8.0";
27 sha256 = "0dlfmvh7jqna6rig39wrnxhklc3k5a3ky3bfq73dqbmcr5hzli8k";
28 };
29in
30buildPythonPackage rec {
31 pname = "ansible-core";
32 version = "2.12.0";
33
34 src = fetchPypi {
35 inherit pname version;
36 sha256 = "sha256-DpBJoauLjFTdyAc43AqytXhwvm/kzU5VhdRxVHq3SxM=";
37 };
38
39 # ansible_connection is already wrapped, so don't pass it through
40 # the python interpreter again, as it would break execution of
41 # connection plugins.
42 postPatch = ''
43 substituteInPlace lib/ansible/executor/task_executor.py \
44 --replace "[python," "["
45 '';
46
47 nativeBuildInputs = [
48 installShellFiles
49 ];
50
51 propagatedBuildInputs = [
52 # depend on ansible-collections instead of the other way around
53 ansible-collections
54 # from requirements.txt
55 cryptography
56 jinja2
57 packaging
58 pyyaml
59 resolvelib
60 # optional dependencies
61 junit-xml
62 lxml
63 ncclient
64 paramiko
65 pexpect
66 psutil
67 pycrypto
68 requests
69 scp
70 xmltodict
71 ] ++ lib.optional windowsSupport pywinrm;
72
73 postInstall = ''
74 installManPage docs/man/man1/*.1
75 '';
76
77 # internal import errors, missing dependencies
78 doCheck = false;
79
80 passthru = {
81 collections = ansible-collections;
82 };
83
84 meta = with lib; {
85 description = "Radically simple IT automation";
86 homepage = "https://www.ansible.com";
87 license = licenses.gpl3Plus;
88 maintainers = with maintainers; [ hexa ];
89 };
90}