Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 anyio, 5 buildPythonPackage, 6 cargo, 7 fetchFromGitHub, 8 rustPlatform, 9 rustc, 10 pythonOlder, 11 dirty-equals, 12 pytest-mock, 13 pytest-timeout, 14 pytestCheckHook, 15 CoreServices, 16 libiconv, 17}: 18 19buildPythonPackage rec { 20 pname = "watchfiles"; 21 version = "0.22.0"; 22 format = "pyproject"; 23 24 disabled = pythonOlder "3.7"; 25 26 src = fetchFromGitHub { 27 owner = "samuelcolvin"; 28 repo = pname; 29 rev = "refs/tags/v${version}"; 30 hash = "sha256-TtRSRgtMOqsnhdvsic3lg33xlA+r/DcYHlzewSOu/44="; 31 }; 32 33 cargoDeps = rustPlatform.fetchCargoTarball { 34 inherit src; 35 name = "${pname}-${version}"; 36 hash = "sha256-n9yN/VRNQWCxh+BoliIMkKqJC51inpB9DQ9WtqR4oA0="; 37 }; 38 39 buildInputs = lib.optionals stdenv.isDarwin [ 40 CoreServices 41 libiconv 42 ]; 43 44 nativeBuildInputs = [ 45 rustPlatform.cargoSetupHook 46 rustPlatform.maturinBuildHook 47 cargo 48 rustc 49 ]; 50 51 propagatedBuildInputs = [ anyio ]; 52 53 # Tests need these permissions in order to use the FSEvents API on macOS. 54 sandboxProfile = '' 55 (allow mach-lookup (global-name "com.apple.FSEvents")) 56 ''; 57 58 nativeCheckInputs = [ 59 dirty-equals 60 pytest-mock 61 pytest-timeout 62 pytestCheckHook 63 ]; 64 65 postPatch = '' 66 sed -i "/^requires-python =.*/a version = '${version}'" pyproject.toml 67 ''; 68 69 preCheck = '' 70 rm -rf watchfiles 71 ''; 72 73 disabledTests = [ 74 # BaseExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) 75 "test_awatch_interrupt_raise" 76 ]; 77 78 pythonImportsCheck = [ "watchfiles" ]; 79 80 meta = with lib; { 81 description = "File watching and code reload"; 82 mainProgram = "watchfiles"; 83 homepage = "https://watchfiles.helpmanual.io/"; 84 license = licenses.mit; 85 maintainers = with maintainers; [ fab ]; 86 }; 87}