{ pkgs, ... }:

{
  languages.python.enable = true;
  languages.python.version = "3.12";

  services.postgres = {
    enable = true;
    package = pkgs.postgresql_15;
    initialDatabases = [ {"name" = "postgres";} ];
    listen_addresses = "localhost";
    initialScript = "create user postgres with password 'postgres' superuser;";
  };

  processes = {
    app.exec = "while ! pg_isready -d postgres -h localhost -U postgres 2>/dev/null; do sleep 1; done; hatch run server";
  };

}
