From b1db30ce36f25eb07a7d4832cc2d29b1697c00f1 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Wed, 26 Feb 2025 16:52:13 -0500 Subject: [PATCH] networking: Restore the original /etc/hosts on activation A patch that replaced the original file with a symlink to nix store was reverted because MacOS Network framework doesn't support symlinks for the file. The revert leaves the system without any /etc/hosts file at all though. To fix this, an activation step is added to restore the original file from .before-nix-darwin backup, if it exists. Signed-off-by: Ihar Hrachyshka --- modules/networking/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/networking/default.nix b/modules/networking/default.nix index b53a9e4..8097e27 100644 --- a/modules/networking/default.nix +++ b/modules/networking/default.nix @@ -132,6 +132,11 @@ in ${optionalString (cfg.wakeOnLan.enable != null) '' systemsetup -setWakeOnNetworkAccess '${onOff cfg.wakeOnLan.enable}' &> /dev/null ''} + + if [ -e /etc/hosts.before-nix-darwin ]; then + echo "restoring /etc/hosts..." >&2 + sudo mv /etc/hosts{.before-nix-darwin,} + fi ''; };