nixpkgs/pkgs/development/python-modules/ansible/base.nix
Martin Weinelt ca618d6401
ansible, ansible_2_10: internalize collections package
This drops the python3Packages.ansible-collections attribute in favor of
a local callPackage that overwrites the collections package per ansible
version.
2021-06-22 18:04:59 +02:00

89 lines
1.7 KiB
Nix

{ lib
, callPackage
, buildPythonPackage
, fetchPypi
, installShellFiles
, cryptography
, jinja2
, junit-xml
, lxml
, ncclient
, packaging
, paramiko
, pexpect
, psutil
, pycrypto
, pyyaml
, requests
, scp
, windowsSupport ? false, pywinrm
, xmltodict
}:
let
ansible-collections = callPackage ./collections.nix {
version = "3.4.0"; # must be < 4.0
sha256 = "096rbgz730njk0pg8qnc27mmz110wqrw354ca9gasb7rqg0f4d6a";
};
in
buildPythonPackage rec {
pname = "ansible-base";
version = "2.10.11";
src = fetchPypi {
inherit pname version;
sha256 = "0jr3cxqiami9k07g2kmvfp54iafbcnd1d66l8fdnaqka5bc19wdw";
};
# ansible_connection is already wrapped, so don't pass it through
# the python interpreter again, as it would break execution of
# connection plugins.
postPatch = ''
substituteInPlace lib/ansible/executor/task_executor.py \
--replace "[python," "["
'';
nativeBuildInputs = [
installShellFiles
];
propagatedBuildInputs = [
# depend on ansible-collections instead of the other way around
ansible-collections
# from requirements.txt
cryptography
jinja2
packaging
pyyaml
# optional dependencies
junit-xml
lxml
ncclient
paramiko
pexpect
psutil
pycrypto
requests
scp
xmltodict
] ++ lib.optional windowsSupport pywinrm;
postInstall = ''
installManPage docs/man/man1/*.1
'';
# internal import errors, missing dependencies
doCheck = false;
passthru = {
collections = ansible-collections;
};
meta = with lib; {
description = "Radically simple IT automation";
homepage = "https://www.ansible.com";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ hexa ];
};
}