Description
The pihole-ftl-setup service fails to add blocklists configured via services.pihole-ftl.lists. The Pi-hole v6 API expects the type parameter (allow/block) as a query parameter, but the setup script sends it in the JSON body.
Error
Adding list: {"address":"https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt","comment":"Hagezi Pro","enabled":true,"type":"block"}
Error: {
"key": "bad_request",
"message": "Invalid request: Specify type parameter (should be either \"allow\" or \"block\")",
"hint": null
}
The service exits with status 1, gravity has 0 domains, and nothing is blocked.
Root cause
In pihole-ftl-setup-script.nix, the addList function calls:
local result=$(PostFTLData "lists" "$payload")
This POSTs to /api/lists with type in the JSON body. The Pi-hole v6 API expects type as a query parameter: /api/lists?type=block.
PostFTLData (from Pi-hole's api.sh) sends the second argument as --data-raw, so type ends up in the body where the API doesn't look for it.
Suggested fix
In pihole-ftl-setup-script.nix:
- Extract
type from the payload before sending
- Append it as a query parameter:
PostFTLData "lists?type=${type}" "$payload_without_type"
Or adjust makePayload to exclude type from the JSON and pass it separately.
Steps to reproduce
services.pihole-ftl = {
enable = true;
settings.dns.upstreams = [ "1.1.1.1" ];
lists = [{
url = "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt";
type = "block";
enabled = true;
description = "test";
}];
};
services.pihole-web = {
enable = true;
ports = [ "8053s" ];
};
After nixos-rebuild switch:
systemctl status pihole-ftl-setup.service # failed
journalctl -u pihole-ftl-setup.service # shows the error above
Metadata
- NixOS version: unstable (nixos-26.05)
- pihole-ftl: 6.4.1
- pihole: 6.1.4
- Module file:
nixos/modules/services/networking/pihole-ftl-setup-script.nix
- Maintainer: @averyvigolo