diff options
author | William A. Kennington III <william@wkennington.com> | 2014-11-24 00:50:26 -0800 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2014-11-26 11:22:02 -0800 |
commit | c234e7b115ec00243982378eae27ee926923bd8e (patch) | |
tree | a2231e16077c3c27b748792af42084e452e46ca0 /nixos/modules | |
parent | 8cffa3778758039cdfdcd35c628796046686dfbf (diff) | |
download | nixlib-c234e7b115ec00243982378eae27ee926923bd8e.tar nixlib-c234e7b115ec00243982378eae27ee926923bd8e.tar.gz nixlib-c234e7b115ec00243982378eae27ee926923bd8e.tar.bz2 nixlib-c234e7b115ec00243982378eae27ee926923bd8e.tar.lz nixlib-c234e7b115ec00243982378eae27ee926923bd8e.tar.xz nixlib-c234e7b115ec00243982378eae27ee926923bd8e.tar.zst nixlib-c234e7b115ec00243982378eae27ee926923bd8e.zip |
nixos/networking: Rebuild resolvconf during activation
This is needed when /etc/resolv.conf is being overriden by networkd and other configurations. If the file is destroyed by an environment activation then it must be rebuilt so that applications which interface with /etc/resolv.conf directly don't break.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/config/networking.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix index 3ab75123110b..711cbb2b70bb 100644 --- a/nixos/modules/config/networking.nix +++ b/nixos/modules/config/networking.nix @@ -98,6 +98,24 @@ in # pulled in by this target. systemd.targets.ip-up.description = "Services Requiring IP Connectivity"; + # This is needed when /etc/resolv.conf is being overriden by networkd + # and other configurations. If the file is destroyed by an environment + # activation then it must be rebuilt so that applications which interface + # with /etc/resolv.conf directly don't break. + system.activationScripts.resolvconf = stringAfter [ "etc" "tmpfs" "var" ] + '' + # Systemd resolved controls its own resolv.conf + rm -f /run/resolvconf/interfaces/systemd + ${optionalString config.services.resolved.enable '' + rm -rf /run/resolvconf/interfaces + mkdir -p /run/resolvconf/interfaces + ln -s /run/systemd/resolve/resolv.conf /run/resolvconf/interfaces/systemd + ''} + + # Make sure resolv.conf is up to date + ${pkgs.openresolv}/bin/resolvconf -u + ''; + }; } |