From 36001254bfd1847fc4328d22020cdd71ba344611 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Wed, 9 Jun 2021 10:07:03 +0200 Subject: [PATCH] script to DNS-block certain sites as a measure against me procrastinating too much --- nixos/configuration.nix | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 0d00b59..fd0cbd2 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -181,9 +181,36 @@ in services.smartd = { enable = true; - devices = [ { device = "/dev/sda"; } { device = "/dev/sdb"; } ]; + devices = [{ device = "/dev/sda"; } { device = "/dev/sdb"; }]; }; + # block certain sites to prevent procrastination + systemd.services.procrastinationstop = { + serviceConfig.Type = "oneshot"; + wantedBy = [ ]; + script = '' + ln -sf ${pkgs.writeText "blockedHosts" '' + ::1 twitter.com + 127.0.0.1 twitter.com + ::1 api.twitter.com + 127.0.0.1 api.twitter.com + ::1 toot.matereal.eu + 127.0.0.1 toot.matereal.eu + ::1 tagesschau.de + 127.0.0.1 tagesschau.de + ::1 dnn.de + 127.0.0.1 dnn.de + ''} /etc/hosts + ''; + }; + + systemd.services.procrastinationstart = { + serviceConfig.Type = "oneshot"; + wantedBy = [ ]; + script = '' + ln -sf /etc/static/hosts /etc/hosts + ''; + }; fonts = { fontDir.enable = true;