1{ lib
2, stdenv
3, python3
4, fetchPypi
5, openssl
6 # Many Salt modules require various Python modules to be installed,
7 # passing them in this array enables Salt to find them.
8, extraInputs ? []
9}:
10
11python3.pkgs.buildPythonApplication rec {
12 pname = "salt";
13 version = "3006.1";
14
15 src = fetchPypi {
16 inherit pname version;
17 hash = "sha256-lVh71hHepq/7aQjQ7CaGy37bhMFBRLSFF3bxJ6YOxbk=";
18 };
19
20 propagatedBuildInputs = with python3.pkgs; [
21 distro
22 jinja2
23 jmespath
24 looseversion
25 markupsafe
26 msgpack
27 packaging
28 psutil
29 pycryptodomex
30 pyyaml
31 pyzmq
32 requests
33 ] ++ extraInputs;
34
35 patches = [
36 ./fix-libcrypto-loading.patch
37 ];
38
39 postPatch = ''
40 substituteInPlace "salt/utils/rsax931.py" \
41 --subst-var-by "libcrypto" "${lib.getLib openssl}/lib/libcrypto${stdenv.hostPlatform.extensions.sharedLibrary}"
42 substituteInPlace requirements/base.txt \
43 --replace contextvars ""
44
45 # Don't require optional dependencies on Darwin, let's use
46 # `extraInputs` like on any other platform
47 echo -n > "requirements/darwin.txt"
48
49 # Remove windows-only requirement
50 substituteInPlace "requirements/zeromq.txt" \
51 --replace 'pyzmq==25.0.2 ; sys_platform == "win32"' ""
52 '';
53
54 # Don't use fixed dependencies on Darwin
55 USE_STATIC_REQUIREMENTS = "0";
56
57 # The tests fail due to socket path length limits at the very least;
58 # possibly there are more issues but I didn't leave the test suite running
59 # as is it rather long.
60 doCheck = false;
61
62 meta = with lib; {
63 homepage = "https://saltproject.io/";
64 changelog = "https://docs.saltproject.io/en/latest/topics/releases/${version}.html";
65 description = "Portable, distributed, remote execution and configuration management system";
66 maintainers = with maintainers; [ Flakebi ];
67 license = licenses.asl20;
68 };
69}