nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 click,
5 distro,
6 fetchFromGitHub,
7 fetchpatch,
8 freezegun,
9 gevent,
10 hatchling,
11 jinja2,
12 packaging,
13 paramiko,
14 pydantic,
15 pyinfra-testgen,
16 pytest-testinfra,
17 pytestCheckHook,
18 python-dateutil,
19 pythonOlder,
20 typeguard,
21 typing-extensions,
22 uv-dynamic-versioning,
23}:
24
25buildPythonPackage rec {
26 pname = "pyinfra";
27 version = "3.6";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "Fizzadar";
32 repo = "pyinfra";
33 tag = "v${version}";
34 hash = "sha256-CTeGn9aN5voyCUL5LuTErLgTgC1Z/qTS7SB9TNfq7mc=";
35 };
36
37 patches = [
38 # paramiko v4 compat
39 # https://github.com/pyinfra-dev/pyinfra/pull/1525
40 (fetchpatch {
41 name = "remove-DSSKey.patch";
42 url = "https://github.com/pyinfra-dev/pyinfra/commit/a655bdf425884055145cfd0011c3b444c9a3ada2.patch";
43 hash = "sha256-puHcA4+KigltCL2tUYRMc9OT3kxvTeW77bbFbxgkcTs=";
44 })
45 ];
46
47 build-system = [
48 hatchling
49 uv-dynamic-versioning
50 ];
51
52 pythonRelaxDeps = [
53 "paramiko"
54 ];
55
56 dependencies = [
57 click
58 distro
59 gevent
60 jinja2
61 packaging
62 paramiko
63 pydantic
64 python-dateutil
65 typeguard
66 ]
67 ++ lib.optionals (pythonOlder "3.11") [ typing-extensions ];
68
69 nativeCheckInputs = [
70 freezegun
71 pyinfra-testgen
72 pytest-testinfra
73 pytestCheckHook
74 ];
75
76 pythonImportsCheck = [ "pyinfra" ];
77
78 disabledTests = [
79 # Test requires SSH binary
80 "test_load_ssh_config"
81 ];
82
83 meta = {
84 description = "Python-based infrastructure automation";
85 longDescription = ''
86 pyinfra automates/provisions/manages/deploys infrastructure. It can be used for
87 ad-hoc command execution, service deployment, configuration management and more.
88 '';
89 homepage = "https://pyinfra.com";
90 downloadPage = "https://pyinfra.com/Fizzadar/pyinfra/releases";
91 changelog = "https://github.com/Fizzadar/pyinfra/blob/${src.tag}/CHANGELOG.md";
92 license = lib.licenses.mit;
93 maintainers = with lib.maintainers; [ totoroot ];
94 mainProgram = "pyinfra";
95 };
96}