How to write derivation to build a python program with systemd in nixos

My python program is in a private git repo.how can I fetchgit and build with dependencies as a systemd service in nixos