Reinstall service from scratch

I am trying to setup a hedgedoc instance and postgresql on a nixos VM. But I have made some mistakes during the first rebuild and now the initial sql script wont run again.
Is it possible to reinstall these services from scratch?

This stackoverflow thread (saved) may be what you are looking for.

(Sorry for the link-only answer but didn’t want to copy-paste that large, especially if it’s not relevant.)

1 Like

In the case of postgresql you can stop the service (systemctl stop postgresql.sevice), delete your dataDir (likely /var/lib/postgresql/), and then start the service again (systemctl start postgresql.service) and you should be good to go.

I’m not familiar with hedgedoc but maybe something similar.

Please make sure you don’t actually still need the data before you delete it, though.

mv /var/lib/postgresql /var/lib/postgresql.bak to be safe :slight_smile:


Making stateful programs like database idempotent needs work… but it’s not impossible.


(mathematics, computing) Said of a function: describing an action which, when performed multiple times on the same subject, has no further effect on its subject after the first time it is performed.
1 Like