Jump to content

Pi-Hole: Difference between revisions

From Official NixOS Wiki
O5-J (talk | contribs)
Add very minimal Pi-Hole Example for others to expand
 
J7 (talk | contribs)
No edit summary
Line 18: Line 18:
     lists = [
     lists = [
         {
         {
             url = "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/adblock/pro.txt";
             url = "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt";
             type = "block";
             type = "block";
             enabled = true;
             enabled = true;

Revision as of 10:59, 27 February 2026

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 = [ "1.1.1.1" ];   # To use Cloudflare's DNS Servers
        hosts = [                        # Optionally resolve local domains
            "192.168.178.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.