Pi-Hole is a DNS service that functions as network ad-blocker.

Minimal Configuration Example

services.pihole-ftl = {
    enable = true;
    openFirewallDNS = true;              # To open port 53 for DNS traffic

    # Settings documented at <https://docs.pi-hole.net/ftldns/configfile/>
    settings = {
        dns.upstreams = [ "9.9.9.9" "1.1.1.1" ];   # To use Quad9 and Cloudflare's DNS Servers
        hosts = [                        # Optionally resolve local domains
            "192.168.1.188 some.domain"
        ];
    };

    # Lists can be added via URL
    lists = [
        {
            url = "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt";
            type = "block";
            enabled = true;
            description = "Sample blocklist by hagezi";
        }
    ];
};

At your option, a web interface can be enabled via services.pihole-web.enable = true;. You will have to open the corresponding ports when doing so.

Now, setting your routers DNS server to your IP will direct your traffic to the Pi-Hole. Blocked domains will not be resolved.