nixos/containers: Enable use of the network.useHostResolvConf option #34354
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for this change
Currently
containers.<name>.networking.useHostResolvConf = false;
can never be set as it's in conflict with thetrue
value in container-config.nix. This PR enables setting the option to false./etc/resolv.conf from the host will still always be copied. nspawn does this only when private networking is not enabled but NixOS does it unconditionally.
nixpkgs/nixos/modules/virtualisation/containers.nix
Line 85 in 5eb4a83
Therefore useHostResolvConf=false relies on resolvconf to overwrite /etc/resolv.conf in the container.
nixpkgs/nixos/modules/system/boot/stage-2-init.sh
Lines 109 to 112 in b4820d4
nixpkgs/nixos/modules/tasks/network-interfaces-scripted.nix
Lines 113 to 117 in 07e0c0e
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)