fix for Genesis and Isaiah
Get gitea-actions running on Isaiah Fix adblock upate on Genesis
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | sed '1,33d' > /etc/adblock_hosts
|
||||
curl -s https://adaway.org/hosts.txt | sed '1,24d' | sed 's/127.0.0.1/0.0.0.0/' >> /etc/adblock_hosts
|
||||
|
||||
# Custom domains that I need to preserve for some reason
|
||||
for f in "segment.com" "segment.io" "branch.io" "dev.visualwebsiteoptimizer.com"; do
|
||||
sed -i -e "/${f}/d" /etc/adblock_hosts # Blocks Trelly content for house investors
|
||||
done
|
||||
|
||||
systemctl restart dnsmasq
|
||||
@@ -2,8 +2,29 @@
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
|
||||
{ pkgs, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
adblockUpdate = pkgs.writeShellApplication {
|
||||
name = "adblock-update";
|
||||
runtimeInputs = with pkgs; [
|
||||
curl
|
||||
gnused
|
||||
systemd
|
||||
];
|
||||
text = ''
|
||||
curl -s https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | sed '1,33d' > /etc/adblock_hosts
|
||||
curl -s https://adaway.org/hosts.txt | sed '1,24d' | sed 's/127.0.0.1/0.0.0.0/' >> /etc/adblock_hosts
|
||||
|
||||
# Custom domains that I need to preserve for some reason
|
||||
for f in "segment.com" "segment.io" "branch.io" "dev.visualwebsiteoptimizer.com"; do
|
||||
sed -i -e "/''${f}/d" /etc/adblock_hosts # Blocks Trelly content for house investors
|
||||
done
|
||||
|
||||
systemctl restart dnsmasq
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
@@ -36,4 +57,20 @@
|
||||
];
|
||||
|
||||
networking.hostName = "genesis"; # Define your hostname.
|
||||
|
||||
systemd = {
|
||||
services.adblock-update = {
|
||||
after = [ "network-online.target" ];
|
||||
script = lib.getExe adblockUpdate;
|
||||
serviceConfig.Type = "oneshot";
|
||||
};
|
||||
timers.adblock-update = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Unit = "adblock-update.service";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ let
|
||||
routerIP = metadata.infra.gw;
|
||||
extraHosts = builtins.readFile ./net/hosts;
|
||||
|
||||
adblockUpdate = pkgs.writeShellScriptBin "adblockUpdate" (builtins.readFile ./adblockUpdate.sh);
|
||||
proxyPort = 3128;
|
||||
dnsPort = 53;
|
||||
dhcpPort = 67;
|
||||
@@ -111,19 +110,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
# Update adblock list
|
||||
cron = {
|
||||
enable = true;
|
||||
systemCronJobs = [ "* * * * * root ${adblockUpdate} 2>&1 > /var/log/adblock.log" ];
|
||||
};
|
||||
|
||||
prometheus.exporters = {
|
||||
dnsmasq.enable = true;
|
||||
kea = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
targets = [ (builtins.head config.services.kea.dhcp4.settings.control-sockets).socket-name ];
|
||||
};
|
||||
};
|
||||
}; # End of services configuration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user