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