1{
2 lib,
3 ansible-compat,
4 ansible-core,
5 buildPythonPackage,
6 click-help-colors,
7 enrich,
8 fetchPypi,
9 jsonschema,
10 molecule,
11 packaging,
12 pluggy,
13 pythonOlder,
14 rich,
15 setuptools,
16 setuptools-scm,
17 testers,
18 wcmatch,
19 withPlugins ? true,
20 molecule-plugins,
21 yamllint,
22}:
23
24buildPythonPackage rec {
25 pname = "molecule";
26 version = "24.7.0";
27 pyproject = true;
28
29 disabled = pythonOlder "3.10";
30
31 src = fetchPypi {
32 inherit pname version;
33 hash = "sha256-2yx/pZkj6b8j1hqSpbGdaIHsnuX+lu2enp1wCwJyPwM=";
34 };
35
36 nativeBuildInputs = [
37 setuptools
38 setuptools-scm
39 ];
40
41 propagatedBuildInputs = [
42 ansible-compat
43 ansible-core
44 click-help-colors
45 enrich
46 jsonschema
47 packaging
48 pluggy
49 rich
50 yamllint
51 wcmatch
52 ] ++ lib.optional withPlugins molecule-plugins;
53
54 pythonImportsCheck = [ "molecule" ];
55
56 # tests can't be easily run without installing things from ansible-galaxy
57 doCheck = false;
58
59 passthru.tests.version =
60 (testers.testVersion {
61 package = molecule;
62 command = "PY_COLORS=0 ${pname} --version";
63 }).overrideAttrs
64 (old: {
65 # workaround the error: Permission denied: '/homeless-shelter'
66 HOME = "$(mktemp -d)";
67 });
68
69 meta = with lib; {
70 description = "Molecule aids in the development and testing of Ansible roles";
71 homepage = "https://github.com/ansible-community/molecule";
72 changelog = "https://github.com/ansible/molecule/releases/tag/v${version}";
73 license = licenses.mit;
74 maintainers = with maintainers; [ dawidd6 ];
75 mainProgram = "molecule";
76 };
77}