summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/entrance/default.nix
blob: c5aea78bb9205442b426d2c80f4a6c282d127f53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{
  lib,
  fetchPypi,
  buildPythonPackage,
  routerFeatures,
  setuptools,
  janus,
  ncclient,
  paramiko,
  pyyaml,
  sanic,
}:

let
  # The `routerFeatures` flag optionally brings in some somewhat heavy
  # dependencies, in order to enable interacting with routers
  opts =
    if routerFeatures then
      {
        prePatch = ''
          substituteInPlace ./setup.py --replace-fail "extra_deps = []" "extra_deps = router_feature_deps"
        '';
        extraBuildInputs = [
          janus
          ncclient
          paramiko
        ];
      }
    else
      {
        prePatch = "";
        extraBuildInputs = [ ];
      };
in

buildPythonPackage rec {
  pname = "entrance";
  version = "1.1.20";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-PvsP6HXCllW102h3o7abz9uC2AZTwvg5qIqP+rdkk6Y=";
  };

  # The versions of `sanic` and `websockets` in nixpkgs only support 3.6 or later

  # No useful tests
  doCheck = false;

  build-system = [ setuptools ];

  dependencies = [
    pyyaml
    sanic
  ]
  ++ opts.extraBuildInputs;

  prePatch = opts.prePatch;

  meta = {
    description = "Server framework for web apps with an Elm frontend";
    homepage = "https://github.com/ensoft/entrance";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ simonchatts ];
  };
}