pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / servers / web-apps / netbox / generic.nix
blobc7a5225a66e3030bb48a878733e29a384cb8d5a7
1 { lib
2 , fetchFromGitHub
3 , python3
4 , version
5 , hash
6 , plugins ? ps: []
7 , extraPatches ? []
8 , tests ? {}
9 , maintainers ? []
10 , eol ? false
12   let
13     extraBuildInputs = plugins python3.pkgs;
14   in
15   python3.pkgs.buildPythonApplication rec {
16       pname = "netbox";
17       inherit version;
19       format = "other";
21       src = fetchFromGitHub {
22         owner = "netbox-community";
23         repo = pname;
24         rev = "refs/tags/v${version}";
25         inherit hash;
26       };
28       patches = extraPatches;
30       propagatedBuildInputs = with python3.pkgs; [
31         bleach
32         boto3
33         django_4
34         django-cors-headers
35         django-debug-toolbar
36         django-filter
37         django-graphiql-debug-toolbar
38         django-mptt
39         django-pglocks
40         django-prometheus
41         django-redis
42         django-rq
43         django-tables2
44         django-taggit
45         django-timezone-field
46         djangorestframework
47         drf-spectacular
48         drf-spectacular-sidecar
49         drf-yasg
50         dulwich
51         swagger-spec-validator # from drf-yasg[validation]
52         feedparser
53         graphene-django
54         jinja2
55         markdown
56         markdown-include
57         netaddr
58         pillow
59         psycopg2
60         pyyaml
61         requests
62         sentry-sdk
63         social-auth-core
64         social-auth-app-django
65         svgwrite
66         tablib
67         jsonschema
68       ] ++ extraBuildInputs;
70       buildInputs = with python3.pkgs; [
71         mkdocs-material
72         mkdocs-material-extensions
73         mkdocstrings
74         mkdocstrings-python
75       ];
77       nativeBuildInputs = [
78         python3.pkgs.mkdocs
79       ];
81       postBuild = ''
82         PYTHONPATH=$PYTHONPATH:netbox/
83         python -m mkdocs build
84       '';
86       installPhase = ''
87         mkdir -p $out/opt/netbox
88         cp -r . $out/opt/netbox
89         chmod +x $out/opt/netbox/netbox/manage.py
90         makeWrapper $out/opt/netbox/netbox/manage.py $out/bin/netbox \
91           --prefix PYTHONPATH : "$PYTHONPATH"
92       '';
94       passthru = {
95         python = python3;
96         # PYTHONPATH of all dependencies used by the package
97         pythonPath = python3.pkgs.makePythonPath propagatedBuildInputs;
98         gunicorn = python3.pkgs.gunicorn;
99         inherit tests;
100       };
102       meta = {
103         homepage = "https://github.com/netbox-community/netbox";
104         description = "IP address management (IPAM) and data center infrastructure management (DCIM) tool";
105         mainProgram = "netbox";
106         license = lib.licenses.asl20;
107         knownVulnerabilities = (lib.optional eol "Netbox version ${version} is EOL; please upgrade by following the current release notes instructions.");
108         # Warning:
109         # Notice the missing `lib` in the inherit: it is using this function argument rather than a `with lib;` argument.
110         # If you replace this by `with lib;`, pay attention it does not inherit all maintainers in nixpkgs.
111         inherit maintainers;
112       };
113     }