Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 antlr4, 4 antlr4-python3-runtime, 5 buildPythonPackage, 6 fetchFromGitHub, 7 fetchpatch, 8 importlib-resources, 9 jre_headless, 10 omegaconf, 11 packaging, 12 pytestCheckHook, 13 pythonOlder, 14 substituteAll, 15}: 16 17buildPythonPackage rec { 18 pname = "hydra-core"; 19 version = "1.3.2"; 20 format = "setuptools"; 21 22 disabled = pythonOlder "3.6"; 23 24 src = fetchFromGitHub { 25 owner = "facebookresearch"; 26 repo = "hydra"; 27 rev = "refs/tags/v${version}"; 28 hash = "sha256-kD4BStnstr5hwyAOxdpPzLAJ9MZqU/CPiHkaD2HnUPI="; 29 }; 30 31 patches = [ 32 (substituteAll { 33 src = ./antlr4.patch; 34 antlr_jar = "${antlr4.out}/share/java/antlr-${antlr4.version}-complete.jar"; 35 }) 36 # https://github.com/facebookresearch/hydra/pull/2731 37 (fetchpatch { 38 name = "setuptools-67.5.0-test-compatibility.patch"; 39 url = "https://github.com/facebookresearch/hydra/commit/25873841ed8159ab25a0c652781c75cc4a9d6e08.patch"; 40 hash = "sha256-oUfHlJP653o3RDtknfb8HaaF4fpebdR/OcbKHzJFK/Q="; 41 }) 42 ]; 43 44 postPatch = '' 45 # We substitute the path to the jar with the one from our antlr4 46 # package, so this file becomes unused 47 rm -v build_helpers/bin/antlr*-complete.jar 48 49 sed -i 's/antlr4-python3-runtime==.*/antlr4-python3-runtime/' requirements/requirements.txt 50 ''; 51 52 nativeBuildInputs = [ jre_headless ]; 53 54 propagatedBuildInputs = [ 55 antlr4-python3-runtime 56 omegaconf 57 packaging 58 ] ++ lib.optionals (pythonOlder "3.9") [ importlib-resources ]; 59 60 nativeCheckInputs = [ pytestCheckHook ]; 61 62 pytestFlagsArray = [ 63 "-W" 64 "ignore::UserWarning" 65 ]; 66 67 # Test environment setup broken under Nix for a few tests: 68 disabledTests = [ 69 "test_bash_completion_with_dot_in_path" 70 "test_install_uninstall" 71 "test_config_search_path" 72 # does not raise UserWarning 73 "test_initialize_compat_version_base" 74 ]; 75 76 disabledTestPaths = [ "tests/test_hydra.py" ]; 77 78 pythonImportsCheck = [ 79 "hydra" 80 # See https://github.com/NixOS/nixpkgs/issues/208843 81 "hydra.version" 82 ]; 83 84 meta = with lib; { 85 description = "Framework for configuring complex applications"; 86 homepage = "https://hydra.cc"; 87 license = licenses.mit; 88 maintainers = with maintainers; [ bcdarwin ]; 89 }; 90}