pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / servers / web-apps / peering-manager / default.nix
blobeb941b85853e62368845a14a2441fd0e7297301e
1 { python3
2 , fetchFromGitHub
3 , nixosTests
4 , lib
6 , plugins ? ps: []
7 }:
9 python3.pkgs.buildPythonApplication rec {
10   pname = "peering-manager";
11   version = "1.8.3";
13   src = fetchFromGitHub {
14     owner = pname;
15     repo = pname;
16     rev = "refs/tags/v${version}";
17     sha256 = "sha256-UV1zSX9C9y5faOBUQ7bfj2DT6ffhMW28MIT7SaYjMgw=";
18   };
20   format = "other";
22   patches = [
23     # Fix compatibility with pyixapi 0.2.3
24     # https://github.com/peering-manager/peering-manager/commit/ee558ff66e467412942559a8a92252e3fc009920
25     ./fix-pyixapi-0.2.3-compatibility.patch
26   ];
28   propagatedBuildInputs = with python3.pkgs; [
29     django
30     djangorestframework
31     django-redis
32     django-debug-toolbar
33     django-filter
34     django-postgresql-netfields
35     django-prometheus
36     django-rq
37     django-tables2
38     django-taggit
39     drf-spectacular
40     drf-spectacular-sidecar
41     jinja2
42     markdown
43     napalm
44     packaging
45     psycopg2
46     pyixapi
47     pynetbox
48     pyyaml
49     requests
50     tzdata
51   ] ++ plugins python3.pkgs;
53   buildPhase = ''
54     runHook preBuild
55     cp peering_manager/configuration{.example,}.py
56     python3 manage.py collectstatic --no-input
57     rm -f peering_manager/configuration.py
58     runHook postBuild
59   '';
61   installPhase = ''
62     runHook preInstall
63     mkdir -p $out/opt/peering-manager
64     cp -r . $out/opt/peering-manager
65     chmod +x $out/opt/peering-manager/manage.py
66     makeWrapper $out/opt/peering-manager/manage.py $out/bin/peering-manager \
67       --prefix PYTHONPATH : "$PYTHONPATH"
68     runHook postInstall
69   '';
71   passthru = {
72     # PYTHONPATH of all dependencies used by the package
73     python = python3;
74     pythonPath = python3.pkgs.makePythonPath propagatedBuildInputs;
76     tests = {
77       inherit (nixosTests) peering-manager;
78     };
79   };
81   meta = with lib; {
82     homepage = "https://peering-manager.net/";
83     license = licenses.asl20;
84     description = "BGP sessions management tool";
85     mainProgram = "peering-manager";
86     maintainers = teams.wdz.members;
87     platforms = platforms.linux;
88   };