NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.66k stars 13.11k forks source link

`services.bind.forwarders` lacks integration for ports #129714

Open Kreyren opened 3 years ago

Kreyren commented 3 years ago

In bind this is a valid configuration:

options {
    forwarders {
        127.0.0.1 port 9053;
    }
}

But services.bind.forwarders only accepts a list of strings requiring to set

services.bind.forwarders = [ "127.0.0.1 port 9053" ];

Proposing to integrate it separatedly to allow for scripting e.g. using 9053 for tor DNS.

Kreyren commented 3 years ago

CC @peti @globin

roberth commented 3 years ago

I don't see why

services.bind.forwarders = [ "127.0.0.1 port 9053" ];

would not be sufficient or not sufficiently scriptable. You could make this conditional with lib.mkIf or lib.optionals and you can use string substitution inside the string.

Kreyren commented 3 years ago

Because it's just replacing a string in a config that expects list of attributes?

roberth commented 3 years ago

Sure it could be structured as something like { host = "127.0.0.1"; port = 9053; }, but it would only benefit the reader of the option, so that it doesn't have to parse a string. However, we only have one reader, which doesn't have to parse it because it's already in the right format.

I like my data structured like anyone else would, so I support a change like this. However, I don't see a reason to prioritize this until we have a use case for reading the option as structured data.

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info