I have the problem, that when i start to consume youtube videos or scroll through social media, it’s really hard to stop and i stay up longer than i want.
A plan to solve this problem is to disable the internet access from 10 pm to 8 am.
What is the best way to do this, on NixOS?
Bonus points for having still access to the LAN, so backups etc work.
a service that rewrites your iptables at 10 pm an 8 am?a
If just the browser is a problem, consider LeechBlock: https://www.proginosko.com/leechblock/examples/
As mentioned that sounds like a job for a systemd service.
But you should also check your router admin panel and see if it can do anything like that. If so, that would be an easy way to block Internet while maintaining LAN access.
Using the firewall seem to be a good solution.
iptables actually supports to set a time, but it’s using UTC, so it will be wrong half a year.
So setting iptables rules with systemd timers is the solution.