diff --git a/guest/common.nix b/guest/common.nix index 88423f2..853acdd 100644 --- a/guest/common.nix +++ b/guest/common.nix @@ -121,6 +121,14 @@ in # /etc/nixos points at the state disk, so the config is snapshotted and # backed up along with everything else the agent owns. + # + # /etc/nixos is a real directory by default on NixOS, not a symlink or + # missing path - `ln -sfn` only replaces an existing LINKNAME in place + # if it's already a symlink; against a plain directory it instead + # creates the link *inside* it (`/etc/nixos/nixos -> ...`), leaving + # /etc/nixos itself untouched. rm -rf first so this is idempotent + # either way. + rm -rf /etc/nixos ln -sfn ${stateDir}/nixos /etc/nixos ''; };