mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-23 21:18:27 +01:00
Compare commits
3 commits
97b64f459e
...
d9a85536a2
| Author | SHA1 | Date | |
|---|---|---|---|
| d9a85536a2 | |||
| 70140d0af4 | |||
| fc6eafab59 |
6 changed files with 51 additions and 6 deletions
17
flake.lock
generated
17
flake.lock
generated
|
|
@ -16,6 +16,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"blocklist": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1772371087,
|
||||||
|
"narHash": "sha256-4exSkO2QcRy+yhQf2tV6jgO3noNNPvSeIad1YLxpazI=",
|
||||||
|
"owner": "StevenBlack",
|
||||||
|
"repo": "hosts",
|
||||||
|
"rev": "484d3c71b9433e08fa887297e25a3b53c0c6fd57",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "StevenBlack",
|
||||||
|
"repo": "hosts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"comin": {
|
"comin": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
|
|
@ -293,6 +309,7 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"betterfox": "betterfox",
|
"betterfox": "betterfox",
|
||||||
|
"blocklist": "blocklist",
|
||||||
"comin": "comin",
|
"comin": "comin",
|
||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
"dns": "dns",
|
"dns": "dns",
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,11 @@
|
||||||
url = "github:iBigQ/radicale-birthday-calendar";
|
url = "github:iBigQ/radicale-birthday-calendar";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
blocklist = {
|
||||||
|
url = "github:StevenBlack/hosts";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
recursive-nameserver.enable = true;
|
recursive-nameserver = {
|
||||||
|
enable = true;
|
||||||
|
blockAds = true;
|
||||||
|
};
|
||||||
private-nameserver.enable = true;
|
private-nameserver.enable = true;
|
||||||
|
|
||||||
syncthing = {
|
syncthing = {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
recursive-nameserver.enable = true;
|
recursive-nameserver = {
|
||||||
|
enable = true;
|
||||||
|
blockAds = true;
|
||||||
|
};
|
||||||
private-nameserver.enable = true;
|
private-nameserver.enable = true;
|
||||||
public-nameserver = {
|
public-nameserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ in
|
||||||
matchConfig.Name = cfg.interface;
|
matchConfig.Name = cfg.interface;
|
||||||
linkConfig.RequiredForOnline = "routable";
|
linkConfig.RequiredForOnline = "routable";
|
||||||
networkConfig.DHCP = lib.mkIf cfg.useDhcp "yes";
|
networkConfig.DHCP = lib.mkIf cfg.useDhcp "yes";
|
||||||
|
dhcpV4Config.UseDNS = lib.mkIf cfg.useDhcp false;
|
||||||
address = lib.optional (cfg.cidr != null) cfg.cidr;
|
address = lib.optional (cfg.cidr != null) cfg.cidr;
|
||||||
routes = lib.optional (cfg.gateway != null) {
|
routes = lib.optional (cfg.gateway != null) {
|
||||||
Gateway = cfg.gateway;
|
Gateway = cfg.gateway;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
allHosts,
|
allHosts,
|
||||||
...
|
...
|
||||||
|
|
@ -8,6 +10,16 @@ let
|
||||||
cfg = config.custom.services.recursive-nameserver;
|
cfg = config.custom.services.recursive-nameserver;
|
||||||
netCfg = config.custom.networking;
|
netCfg = config.custom.networking;
|
||||||
|
|
||||||
|
blocklist =
|
||||||
|
pkgs.runCommand "blocklist.conf" { } ''
|
||||||
|
echo "server:" > $out
|
||||||
|
cat ${inputs.blocklist}/hosts \
|
||||||
|
| grep '^0.0.0.0 ' \
|
||||||
|
| awk '$2 != "0.0.0.0" {print " local-zone: \"" $2 "\" refuse"}' \
|
||||||
|
>> $out
|
||||||
|
''
|
||||||
|
|> toString;
|
||||||
|
|
||||||
privateNameservers =
|
privateNameservers =
|
||||||
allHosts
|
allHosts
|
||||||
|> lib.attrValues
|
|> lib.attrValues
|
||||||
|
|
@ -20,6 +32,7 @@ in
|
||||||
type = lib.types.port;
|
type = lib.types.port;
|
||||||
default = 53;
|
default = 53;
|
||||||
};
|
};
|
||||||
|
blockAds = lib.mkEnableOption "";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable (
|
config = lib.mkIf cfg.enable (
|
||||||
|
|
@ -28,11 +41,14 @@ in
|
||||||
services = {
|
services = {
|
||||||
unbound = {
|
unbound = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.server = {
|
settings = {
|
||||||
|
server = {
|
||||||
interface = [ "${netCfg.overlay.address}@${toString cfg.port}" ];
|
interface = [ "${netCfg.overlay.address}@${toString cfg.port}" ];
|
||||||
access-control = [ "${toString netCfg.overlay.networkCidr} allow" ];
|
access-control = [ "${toString netCfg.overlay.networkCidr} allow" ];
|
||||||
prefetch = true;
|
prefetch = true;
|
||||||
};
|
};
|
||||||
|
include-toplevel = lib.mkIf cfg.blockAds blocklist;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nebula.networks.mesh.firewall.inbound = lib.singleton {
|
nebula.networks.mesh.firewall.inbound = lib.singleton {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue