Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/networking: support static resolv.conf #32308

Merged
merged 1 commit into from Dec 4, 2017

Conversation

orivej
Copy link
Contributor

@orivej orivej commented Dec 4, 2017

Motivation for this change

This is necessary to support such use as:

{
  config = {
    environment.etc = {
      "resolv.conf".text = "nameserver 127.0.0.1\n";
    };
}

When /nix/store is read-only this already works except that resolvconf warns that it can not update /etc/resolv.conf; when /nix/store is writable, without this change resolvconf corrupts the store.

When config.services.resolved.enable = true, config.environment.etc."resolv.conf" is defined, so keeping the old conditional is redundant:

} // optionalAttrs config.services.resolved.enable {
# symlink the static version of resolv.conf as recommended by upstream:
# https://www.freedesktop.org/software/systemd/man/systemd-resolved.html#/etc/resolv.conf
"resolv.conf".source = "${pkgs.systemd}/lib/systemd/resolv.conf";

Things done

I have tested this PR with all combination of settings: services.resolved.enable = true | false, environment.etc = { "resolv.conf" = } | { }, services.dnsmasq.enable = true | false. It does not break anything and works as intended.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@orivej orivej merged commit 81e5b51 into NixOS:master Dec 4, 2017
@orivej orivej deleted the static-resolv-conf branch December 4, 2017 16:08
@danbst
Copy link
Contributor

danbst commented Dec 5, 2017

You may also be interested in this issue
#28496

xaverdh pushed a commit to xaverdh/nixpkgs that referenced this pull request Mar 9, 2019
…ed manually (NixOS#56682)

The second invocation of resolvconf, missed in NixOS#32308
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants