at 25.11-pre 1.8 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 4 rustPlatform, 5 cacert, 6 buildPythonPackage, 7 uvloop, 8 click, 9 setproctitle, 10 watchfiles, 11 versionCheckHook, 12 pytestCheckHook, 13 pytest-asyncio, 14 websockets, 15 httpx, 16 sniffio, 17 nix-update-script, 18}: 19 20buildPythonPackage rec { 21 pname = "granian"; 22 version = "2.2.5"; 23 pyproject = true; 24 25 src = fetchFromGitHub { 26 owner = "emmett-framework"; 27 repo = "granian"; 28 tag = "v${version}"; 29 hash = "sha256-fToH8sKh0M75D9YuyqkMEqY+cQio1NUmYdk/TEGy3fk="; 30 }; 31 32 cargoDeps = rustPlatform.fetchCargoVendor { 33 inherit pname version src; 34 hash = "sha256-ThH4sk3yLvR9bklosUhCbklkcbpLW/5I1ukBNxUyqr8="; 35 }; 36 37 nativeBuildInputs = with rustPlatform; [ 38 cargoSetupHook 39 maturinBuildHook 40 ]; 41 42 dependencies = [ 43 click 44 ]; 45 46 optional-dependencies = { 47 pname = [ setproctitle ]; 48 reload = [ watchfiles ]; 49 # rloop = [ rloop ]; # not packaged 50 uvloop = [ uvloop ]; 51 }; 52 53 nativeCheckInputs = [ 54 versionCheckHook 55 pytestCheckHook 56 pytest-asyncio 57 websockets 58 httpx 59 sniffio 60 ]; 61 62 preCheck = '' 63 # collides with the one installed in $out 64 rm -rf granian/ 65 ''; 66 67 # needed for checks 68 env.SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; 69 70 __darwinAllowLocalNetworking = true; 71 72 pytestFlagsArray = [ "tests/" ]; 73 74 pythonImportCheck = [ "granian" ]; 75 76 versionCheckProgramArg = "--version"; 77 78 passthru.updateScript = nix-update-script { }; 79 80 meta = { 81 description = "Rust HTTP server for Python ASGI/WSGI/RSGI applications"; 82 homepage = "https://github.com/emmett-framework/granian"; 83 license = lib.licenses.bsd3; 84 mainProgram = "granian"; 85 maintainers = with lib.maintainers; [ 86 lucastso10 87 pbsds 88 ]; 89 platforms = lib.platforms.unix; 90 }; 91}