22 lib ,
33 fetchFromGitHub ,
44 rustPlatform ,
5+ cacert ,
56 buildPythonPackage ,
67 uvloop ,
78 click ,
8- libiconv ,
9+ setproctitle ,
10+ watchfiles ,
11+ versionCheckHook ,
12+ pytestCheckHook ,
13+ pytest-asyncio ,
14+ websockets ,
15+ httpx ,
16+ sniffio ,
917 nix-update-script ,
1018} :
1119
@@ -17,13 +25,12 @@ buildPythonPackage rec {
1725 src = fetchFromGitHub {
1826 owner = "emmett-framework" ;
1927 repo = "granian" ;
20- rev = "v${ version } " ;
28+ tag = "v${ version } " ;
2129 hash = "sha256-YQ9+PcKXtSc+wdvhgDfSAfcv/y53oqcrPCEI9dDKFa0=" ;
2230 } ;
2331
2432 cargoDeps = rustPlatform . fetchCargoVendor {
25- inherit src ;
26- name = "${ pname } -${ version } " ;
33+ inherit pname version src ;
2734 hash = "sha256-XJ61+u5aGQis6YkfASD+WJHEKDBL+2ImqCAuQmm3A/g=" ;
2835 } ;
2936
@@ -32,23 +39,53 @@ buildPythonPackage rec {
3239 maturinBuildHook
3340 ] ;
3441
35- buildInputs = [
36- libiconv
37- ] ;
38-
3942 dependencies = [
40- uvloop
4143 click
4244 ] ;
4345
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+
4478 passthru . updateScript = nix-update-script { } ;
4579
4680 meta = {
4781 description = "Rust HTTP server for Python ASGI/WSGI/RSGI applications" ;
4882 homepage = "https://github.com/emmett-framework/granian" ;
4983 license = lib . licenses . bsd3 ;
5084 mainProgram = "granian" ;
51- maintainers = with lib . maintainers ; [ lucastso10 ] ;
85+ maintainers = with lib . maintainers ; [
86+ lucastso10
87+ pbsds
88+ ] ;
5289 platforms = lib . platforms . unix ;
5390 } ;
5491}
0 commit comments