For what you have going on, a used laptop would be great. Pick one up with a broken screen, and take out the magnet in the lid. Most laptops use a hall sensor or reed switch to tell when the lid is closed and send a sleep signal.
The one issue with pi is that you can’t use some x86 server software. I have a seafile instance for by NAS and that was a pain to get running on my pi4