105 lines
2.2 KiB
Nix
105 lines
2.2 KiB
Nix
{ buildPythonApplication
|
|
, overrideScope
|
|
, fetchFromGitHub
|
|
, lib
|
|
, callPackage
|
|
, configuration ? ""
|
|
, psycopg2
|
|
}:
|
|
|
|
let
|
|
deps = overrideScope (callPackage ./python-packages.nix {});
|
|
in
|
|
buildPythonApplication rec {
|
|
pname = "netbox";
|
|
version = "3.2.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "netbox-community";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "0blqlfl7djl1zb92cvqndy5l8drn0axjjqvhjc1q881h3sif123w";
|
|
};
|
|
|
|
propagatedBuildInputs = (with deps; [
|
|
bleach
|
|
django
|
|
django-cors-headers
|
|
django-debug-toolbar
|
|
django-filter
|
|
django-graphiql-debug-toolbar
|
|
django-mptt
|
|
django-pglocks
|
|
django-prometheus
|
|
django-redis
|
|
django-rq
|
|
django-tables2
|
|
django-taggit
|
|
django-timezone-field
|
|
djangorestframework
|
|
drf-yasg
|
|
graphene-django
|
|
gunicorn
|
|
Jinja2
|
|
Markdown
|
|
markdown-include
|
|
mkdocs-material
|
|
mkdocstrings
|
|
mkdocstrings-python-legacy
|
|
netaddr
|
|
pillow
|
|
PyYAML
|
|
sentry-sdk
|
|
social-auth-app-django
|
|
social-auth-core
|
|
svgwrite
|
|
tablib
|
|
tzdata
|
|
jsonschema
|
|
|
|
django-storages
|
|
]) ++ [
|
|
psycopg2
|
|
];
|
|
|
|
format = "other";
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
# Do nothing.
|
|
runHook postBuild
|
|
'';
|
|
|
|
passAsFile = [ "configuration" ];
|
|
inherit configuration;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/share/netbox
|
|
cp -R . $out/share/netbox
|
|
PYVER="$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")"
|
|
PYDIR="$out/lib/python$PYVER"
|
|
mkdir -p $PYDIR
|
|
ln -s $out/share/netbox/netbox $PYDIR/site-packages
|
|
mkdir -p $out/bin
|
|
cp $out/share/netbox/netbox/manage.py $out/bin/netbox-manage
|
|
|
|
cat <<"EOF" >$out/bin/netbox-gunicorn
|
|
#!/usr/bin/python
|
|
import sys
|
|
from gunicorn.app.wsgiapp import run
|
|
if __name__ == '__main__':
|
|
sys.exit(run())
|
|
EOF
|
|
chmod +x $out/bin/netbox-gunicorn
|
|
|
|
cp $out/share/netbox/netbox/netbox/configuration_testing.py $out/share/netbox/netbox/netbox/configuration.py
|
|
PYTHONPATH=$PYDIR/site-packages:$PYTHONPATH python $out/bin/netbox-manage collectstatic --no-input
|
|
|
|
cp $configurationPath $out/share/netbox/netbox/netbox/configuration.py
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.deps = deps;
|
|
}
|