summaryrefslogtreecommitdiff
path: root/archetypes/profiles/router/default.nix
blob: 58e34079ce0b8e370fddf957b422c24aeb5519f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ lib, pkgs, ... }: let
	mkRouter = lib.mkOverride 800;

	# https://wiki.nixos.org/wiki/Networking
	nixosConfig = {
		services.unbound = {
			_blocklists = {
				enable = true;
				blocklists = let
					hageziList = list: [
						"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/rpz/${list}.txt"
						"https://gitlab.com/hagezi/mirror/-/raw/main/dns-blocklists/rpz/${list}.txt"
						"https://codeberg.org/hagezi/mirror2/raw/branch/main/dns-blocklists/rpz/${list}.txt"
					];
				in {
					hageziNSFW = hageziList "nsfw";
					hageziPro = hageziList "pro";
				};
			};
		};
		services._router = {
			dnsDhcpConfig.enable = mkRouter true;
			routing = {
				enable = mkRouter true;
				interfaces = {
					lan = mkRouter "lan0";
					wan = mkRouter "wan0";
				};
			};
		};
	};

	homeConfig = {};
in {
	imports = [ (lib._mkProfileArchetype "router" nixosConfig homeConfig) ];
}