I started the project django-nixos some time ago. I’m using this on a regular basis to deploy django projects.
It has examples for nixos and nixops including reverse nginx with auto letsencrypt and so on.
It includes:
A PostgreSQL DB with access configured for django
A systemd service which serves the project via gunicorn
A defined way of passing secrets to Django without leaking them into /nix/store
Your static files as a separated build artifact (by default served via whitenoise)
Ability to configure some common options like (allowed-hosts, port, processes, threads) through your nix config.
Having your manage.py globally callable via manage-projectname (only via root/sudo)
Let me know if you have any more questions! Also feel free to contribute.
It appears to me that the specific problem you have with gunicorn is to use –chdir to be able to access your python project. Better use –pythonpath instead.