···8484 dnsmasq_conf=/etc/dnsmasq-conf.conf
8585 dnsmasq_resolv=/etc/dnsmasq-resolv.conf
8686 '';
8787- };
8787+8888+ } // (optionalAttrs config.services.resolved.enable (
8989+ if dnsmasqResolve then {
9090+ "dnsmasq-resolv.conf".source = "/run/systemd/resolve/resolv.conf";
9191+ } else {
9292+ "resolv.conf".source = "/run/systemd/resolve/resolv.conf";
9393+ }
9494+ ));
88958996 # The ‘ip-up’ target is started when we have IP connectivity. So
9097 # services that depend on IP connectivity (like ntpd) should be
9198 # pulled in by this target.
9299 systemd.targets.ip-up.description = "Services Requiring IP Connectivity";
100100+101101+ # This is needed when /etc/resolv.conf is being overriden by networkd
102102+ # and other configurations. If the file is destroyed by an environment
103103+ # activation then it must be rebuilt so that applications which interface
104104+ # with /etc/resolv.conf directly don't break.
105105+ system.activationScripts.resolvconf = stringAfter [ "etc" "tmpfs" "var" ]
106106+ ''
107107+ # Systemd resolved controls its own resolv.conf
108108+ rm -f /run/resolvconf/interfaces/systemd
109109+ ${optionalString config.services.resolved.enable ''
110110+ rm -rf /run/resolvconf/interfaces
111111+ mkdir -p /run/resolvconf/interfaces
112112+ ln -s /run/systemd/resolve/resolv.conf /run/resolvconf/interfaces/systemd
113113+ ''}
114114+115115+ # Make sure resolv.conf is up to date if not managed by systemd
116116+ ${optionalString (!config.services.resolved.enable) ''
117117+ ${pkgs.openresolv}/bin/resolvconf -u
118118+ ''}
119119+ '';
9312094121 };
95122