services/unbound: bring back

This commit is contained in:
LavaDesu 2025-05-22 22:57:47 +10:00
parent 1ecec11727
commit 17164b05b9
Signed by: cilly
GPG key ID: 6500251E087653C9
4 changed files with 30 additions and 5 deletions

17
flake.lock generated
View file

@ -722,6 +722,7 @@
"pure": "pure", "pure": "pure",
"spicetify-nix": "spicetify-nix", "spicetify-nix": "spicetify-nix",
"spotify-adblock": "spotify-adblock", "spotify-adblock": "spotify-adblock",
"stevenblack-hosts": "stevenblack-hosts",
"tree-sitter-jsonc": "tree-sitter-jsonc", "tree-sitter-jsonc": "tree-sitter-jsonc",
"website": "website", "website": "website",
"wine-discord-ipc-bridge": "wine-discord-ipc-bridge", "wine-discord-ipc-bridge": "wine-discord-ipc-bridge",
@ -766,6 +767,22 @@
"type": "github" "type": "github"
} }
}, },
"stevenblack-hosts": {
"flake": false,
"locked": {
"lastModified": 1747792192,
"narHash": "sha256-HeWotX8CVc3vDlvAGq99FaeAT9JRSWtx4N/NhtjPwtg=",
"owner": "StevenBlack",
"repo": "hosts",
"rev": "dbdcb032706dfe548745266218501afa93c14ad5",
"type": "github"
},
"original": {
"owner": "StevenBlack",
"repo": "hosts",
"type": "github"
}
},
"systems": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,

View file

@ -22,7 +22,7 @@
spicetify-nix.inputs.nixpkgs.follows = "nixpkgs"; spicetify-nix.inputs.nixpkgs.follows = "nixpkgs";
# services # services
# hosts-blocklists = { url = "github:notracking/hosts-blocklists"; flake = false; }; stevenblack-hosts = { url = "github:StevenBlack/hosts"; flake = false; };
website = { url = "github:LavaDesu/lavadesu.github.io/master"; flake = false; }; website = { url = "github:LavaDesu/lavadesu.github.io/master"; flake = false; };
# zsh plugins # zsh plugins

View file

@ -21,6 +21,7 @@
modules.services.nginx modules.services.nginx
modules.services.postgres modules.services.postgres
modules.services.unbound
./filesystem.nix ./filesystem.nix
./kernel.nix ./kernel.nix

View file

@ -1,8 +1,12 @@
{ inputs, ... }: { inputs, pkgs, gcSecrets, ... }:
let let
dir = "/persist/unbound"; dir = "/persist/unbound";
converted = pkgs.runCommand "stevenblack-hosts-unbound" {} ''
grep '^0\.0\.0\.0' "${inputs.stevenblack-hosts}/hosts" | awk '{print "local-zone: \""$2"\" always_refuse"}' > "$out"
'';
in { in {
networking.firewall.interfaces.wlan0 = { networking.firewall.interfaces.wg0 = {
allowedUDPPorts = [ 53 853 ]; allowedUDPPorts = [ 53 853 ];
allowedTCPPorts = [ 53 853 ]; allowedTCPPorts = [ 53 853 ];
}; };
@ -16,17 +20,20 @@ in {
name = "."; name = ".";
forward-tls-upstream = true; forward-tls-upstream = true;
forward-addr = [ forward-addr = [
"2606:4700:4700::1111@853#cloudflare-dns.com"
"2606:4700:4700::1001@853#cloudflare-dns.com"
"1.1.1.1@853#cloudflare-dns.com" "1.1.1.1@853#cloudflare-dns.com"
"1.0.0.1@853#cloudflare-dns.com" "1.0.0.1@853#cloudflare-dns.com"
]; ];
}]; }];
server = { server = {
interface = [ "0.0.0.0" ]; interface = [ "0.0.0.0" "::0" ];
access-control = [ access-control = [
"127.0.0.1/8 allow" "127.0.0.1/8 allow"
"10.0.0.0/8 allow" "10.0.0.0/8 allow"
"192.168.100.0/24 allow" "192.168.100.0/24 allow"
"${gcSecrets.wireguard.ipv6Subnet}/80 allow"
]; ];
domain-insecure = [ "\"local.lava.moe\"" ]; domain-insecure = [ "\"local.lava.moe\"" ];
local-zone = [ "\"warden.local.lava.moe.\" redirect" ]; local-zone = [ "\"warden.local.lava.moe.\" redirect" ];
@ -35,7 +42,7 @@ in {
]; ];
}; };
include = "${inputs.hosts-blocklists}/unbound/unbound.blacklist.conf"; include = "${converted}";
}; };
}; };