Multiple issues with services.bind configuration

I’m having some trouble with setting up the service bind on my system. A product I’m working on just introduced some dynamic DNS stuff to its backend, and for me to develop locally, I need to get bind up and running. Part of the required config is for allow-query { all; }; to be set in the options block. However, this isn’t an option in services.bind, and trying to use extraOptions to add that it causes the bind service to fail, because nix adds the line allow-query { cachenetworks; }; into options on its own. Is there any way around this, beyond overriding the config file entirely?

Also, setting services.bind.enable = true changes resolv.conf to have localhost as the only nameserver. This is undesirable. Is there any way to override this behavior?

Tip: instead of setting up bind globally on a certain dev machine, set up whatever you need in a specific development environment. That would be the Nix way.

Sounds like you’re using extraOptions wrong. It says:

Extra lines to be added verbatim to the options section of the generated named configuration file.

So that wouldn’t be Nix code. It would be in the upstream config file format.

I hadn’t even considered that bind could be part of a dev environment! I’ll definitely look into that.
I understand what extraOptions does. I was just curious if something like allow-query, which isn’t actually an option on services.bind, was hard-coded, or if I could override it without overriding the entire file.

Overriding which entire file, sorry?

named.conf

this sentence was added to make this reply at least 20 characters

There answer to that should be fairly clear within the implementation. But I would again recommend setting up whatever service you need in the development environment, instead. And perhaps it’s not exactly bind. Perhaps there are simpler implementations.