about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/web-apps/peering-manager/default.nix
blob: aec18b2904c60c2f6d5a395645058d7ae143f06d (plain) (blame)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{ python3
, fetchFromGitHub
, fetchpatch
, nixosTests
, lib

, plugins ? ps: []
}:

python3.pkgs.buildPythonApplication rec {
  pname = "peering-manager";
  version = "1.8.3";

  src = fetchFromGitHub {
    owner = pname;
    repo = pname;
    rev = "refs/tags/v${version}";
    sha256 = "sha256-UV1zSX9C9y5faOBUQ7bfj2DT6ffhMW28MIT7SaYjMgw=";
  };

  format = "other";

  propagatedBuildInputs = with python3.pkgs; [
    django
    djangorestframework
    django-redis
    django-debug-toolbar
    django-filter
    django-postgresql-netfields
    django-prometheus
    django-rq
    django-tables2
    django-taggit
    drf-spectacular
    drf-spectacular-sidecar
    jinja2
    markdown
    napalm
    packaging
    psycopg2
    pyixapi
    pynetbox
    pyyaml
    requests
    tzdata
  ] ++ plugins python3.pkgs;

  buildPhase = ''
    runHook preBuild
    cp peering_manager/configuration{.example,}.py
    python3 manage.py collectstatic --no-input
    rm -f peering_manager/configuration.py
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall
    mkdir -p $out/opt/peering-manager
    cp -r . $out/opt/peering-manager
    chmod +x $out/opt/peering-manager/manage.py
    makeWrapper $out/opt/peering-manager/manage.py $out/bin/peering-manager \
      --prefix PYTHONPATH : "$PYTHONPATH"
    runHook postInstall
  '';

  passthru = {
    # PYTHONPATH of all dependencies used by the package
    python = python3;
    pythonPath = python3.pkgs.makePythonPath propagatedBuildInputs;

    tests = {
      inherit (nixosTests) peering-manager;
    };
  };

  meta = with lib; {
    homepage = "https://peering-manager.net/";
    license = licenses.asl20;
    description = "BGP sessions management tool";
    mainProgram = "peering-manager";
    maintainers = teams.wdz.members;
    platforms = platforms.linux;
  };
}