diff --git a/hosts/genesis/adblockUpdate.sh b/hosts/genesis/adblockUpdate.sh new file mode 100644 index 0000000..1f60fa8 --- /dev/null +++ b/hosts/genesis/adblockUpdate.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -ex + + +curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | sed '1,33d' > /etc/adblock_hosts + +# Custom domains that I need to preserve for some reason +sed -i -e '/segment.com/d' /etc/adblock_hosts # Blocks Trelly content for house investors +sed -i -e '/segment.io/d' /etc/adblock_hosts # Blocks Trelly content for house investors + +systemctl restart dnsmasq diff --git a/hosts/genesis/dnsmasq.nix b/hosts/genesis/dnsmasq.nix index 296a020..174cd44 100644 --- a/hosts/genesis/dnsmasq.nix +++ b/hosts/genesis/dnsmasq.nix @@ -24,6 +24,8 @@ let ]; lanDevice = "enp1s0"; + + adblockUpdate = pkgs.writeShellScriptBin "adblockUpdate" (builtins.readFile ./adblockUpdate.sh); in { # Enable the service with its own configuration @@ -96,7 +98,7 @@ in services.cron = { enable = true; systemCronJobs = [ - "* * * * * root ( ${pkgs.curl}/bin/curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | sed '1,33d' > /etc/adblock_hosts && systemctl restart dnsmasq ) 2>&1 > /var/log/adblock.log" + "* * * * * root ${adblockUpdate} 2>&1 > /var/log/adblock.log" ]; };