From 3b740547c4db083547a77b1a422897a7989957b1 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Mon, 23 Aug 2021 20:00:19 +0200 Subject: [PATCH] tab to 2 spaces --- home/code.nix | 2 +- hosts/architect/dns.nix | 36 ++++++++++++++ hosts/architect/minecraft.nix | 17 +++++++ .../architect/scripts/fetch-adblock-hosts.sh | 49 +++++++++++++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 hosts/architect/dns.nix create mode 100644 hosts/architect/minecraft.nix create mode 100644 hosts/architect/scripts/fetch-adblock-hosts.sh diff --git a/home/code.nix b/home/code.nix index abc6f60..cee2e5b 100644 --- a/home/code.nix +++ b/home/code.nix @@ -64,7 +64,7 @@ " Fix for code not being aligned if between comment blocks set cindent cinkeys-=0# - set expandtab shiftwidth=4 tabstop=4 softtabstop=4 + set expandtab shiftwidth=2 tabstop=2 softtabstop=2 ''; viAlias = true; diff --git a/hosts/architect/dns.nix b/hosts/architect/dns.nix new file mode 100644 index 0000000..1376bf9 --- /dev/null +++ b/hosts/architect/dns.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }: + +{ + services = { + dnsmasq = { + enable = true; + servers = ["127.0.0.1#5353"]; + extraConfig = '' + localise-queries + min-cache-ttl=120 + max-cache-ttl=2400 + ''; + }; + + dnscrypt-proxy2 = { + enable = true; + settings = { + listen_addresses = ["127.0.0.1:5353"]; + ipv4_servers = true; + ipv6_servers = false; + block_ipv6 = true; + dnscrypt_servers = true; + doh_servers = true; + require_nolog = true; + require_nofilter = true; + timeout = 350; + lb_strategy = "p4"; + lb_estimator = true; + ignore_system_dns = true; + fallback_resolvers = ["1.1.1.1:53" "9.9.9.9:53"]; + cache_min_ttl = 450; + cache_max_ttl = 2400; + }; + }; + }; +} diff --git a/hosts/architect/minecraft.nix b/hosts/architect/minecraft.nix new file mode 100644 index 0000000..fa5f02f --- /dev/null +++ b/hosts/architect/minecraft.nix @@ -0,0 +1,17 @@ +{config, pkgs, ...}: + +with import ./network.nix; +{ + services.minecraft = { + enable = true; + eula = true; + serverProperties = { + motd = "Welcome on the RuNas server!"; + }; + }; + + networking.extraHosts = '' + ${architect-lan} minecraft.giugl.io + ${architect-wg} minecraft.giugl.io + ''; +} diff --git a/hosts/architect/scripts/fetch-adblock-hosts.sh b/hosts/architect/scripts/fetch-adblock-hosts.sh new file mode 100644 index 0000000..67416e1 --- /dev/null +++ b/hosts/architect/scripts/fetch-adblock-hosts.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +EASYLIST_HOSTSNAME="easylist_hosts.txt" +EASYPRIVACY_HOSTSNAME="easyprivacy_hosts.txt" +STEVENBLACK_HOSTSNAME="stevenblack_hosts.txt" + +get_easylist() { + EASYLIST_URL="https://raw.githubusercontent.com/easylist/easylist/master/easylist/easylist_adservers.txt" + + tmpfile=`mktemp` + + # download easylist + ${pkgs.wget}/bin/wget $EASYLIST_URL -O $tmpfile + + # remove IP addresses and prepend 0.0.0.0 to create hosts file + + cat $tmpfile | egrep -v "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -oP "^\|\|(\K[a-zA-Z0-9\.\-]+)" | ${pkgs.gawk}/bin/gawk '{print "0.0.0.0 " $0}' > $EASYLIST_HOSTSNAME +} + +get_easyprivacy() { + EASYLIST_URL="https://raw.githubusercontent.com/easylist/easylist/master/easyprivacy/easyprivacy_trackingservers.txt" + + tmpfile=`mktemp` + + # download easylist + ${pkgs.wget}/bin/wget $EASYLIST_URL -O $tmpfile + + # remove IP addresses and prepend 0.0.0.0 to create hosts file + + cat $tmpfile | egrep -v "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -oP "^\|\|(\K[a-zA-Z0-9\.\-]+)" | ${pkgs.gawk}/bin/gawk '{print "0.0.0.0 " $0}' > $EASYPRIVACY_HOSTSNAME +} + +get_stevenblack() { + STEVENBLACK_URL="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews/hosts" + + ${pkgs.wget}/bin/wget $STEVENBLACK_URL -O $STEVENBLACK_HOSTSNAME +} + + +get_easylist +get_easyprivacy +get_stevenblack + + +# create unified file + +cat *hosts.txt | sort | uniq | grep "^0" > /etc/adblock_hosts + +rm $EASYLIST_HOSTSNAME $STEVENBLACK_HOSTSNAME