You can create a database, user and credentials by using clicks.services.postgres.databases.<name>
. You should set this to a file containing the password for your database user.
We recommend using agenix-rekey to create this password file
clicks.services.postgres = { enable = true; databases.headscale = config.age.secrets."clicks.services.postgres.databases.headscale".path; };
If your password file needs a specific group to read, you can use clicks.services.postgres.secretRequiredGroups
to allow postgres to read the file.
clicks.services.postgres.secretRequiredGroups = [ "headscale" ];
If you're using a systemd service to start your application, and you're runinng on the same machine as postgres, you may additionally want to ensure that postgres is always started and stopped in sequence with your service.
systemd.services.headscale.requires = [ "postgresql.service" ]; systemd.services.headscale.after = [ "postgresql.service" ];