1{
2 lib,
3 fetchPypi,
4 buildPythonPackage,
5 pythonOlder,
6 routerFeatures,
7 setuptools,
8 janus,
9 ncclient,
10 paramiko,
11 pyyaml,
12 sanic,
13}:
14
15let
16 # The `routerFeatures` flag optionally brings in some somewhat heavy
17 # dependencies, in order to enable interacting with routers
18 opts =
19 if routerFeatures then
20 {
21 prePatch = ''
22 substituteInPlace ./setup.py --replace-fail "extra_deps = []" "extra_deps = router_feature_deps"
23 '';
24 extraBuildInputs = [
25 janus
26 ncclient
27 paramiko
28 ];
29 }
30 else
31 {
32 prePatch = "";
33 extraBuildInputs = [ ];
34 };
35in
36
37buildPythonPackage rec {
38 pname = "entrance";
39 version = "1.1.20";
40 pyproject = true;
41
42 src = fetchPypi {
43 inherit pname version;
44 hash = "sha256-PvsP6HXCllW102h3o7abz9uC2AZTwvg5qIqP+rdkk6Y=";
45 };
46
47 # The versions of `sanic` and `websockets` in nixpkgs only support 3.6 or later
48 disabled = pythonOlder "3.6";
49
50 # No useful tests
51 doCheck = false;
52
53 build-system = [ setuptools ];
54
55 dependencies = [
56 pyyaml
57 sanic
58 ]
59 ++ opts.extraBuildInputs;
60
61 prePatch = opts.prePatch;
62
63 meta = with lib; {
64 description = "Server framework for web apps with an Elm frontend";
65 homepage = "https://github.com/ensoft/entrance";
66 license = licenses.mit;
67 maintainers = with maintainers; [ simonchatts ];
68 };
69}