Unverified Commit 692e94a1 authored by whispers's avatar whispers
Browse files

nixos-rebuild-ng: don't resolve /run/current-system symlink for --diff

Before running `nix store diff-closures`, `nixos-rebuild-ng` tried to
read the symlink on the local system. While this provides for better
logging, when paired with `--target-host`, it causes deploy failures
as it tries to diff the config of the local system against the target.
Even if the store path of the local system happens to be on the target,
the diff is incorrect, as its comparing two different systems against
each other instead of the old and new closures on the target system.

Accordingly, we simply avoid resolving the symlink on the host system.
If a future solution would like to fix this, it should make sure to
do the reading for debug printing on the *target* sytem, not the local
one.
parent dbe0cf5d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ def build_and_activate_system(
    if args.diff:
        if current_config.exists():
            nix.diff_closures(
                current_config=current_config.readlink(),
                current_config=current_config,
                new_config=path_to_config,
                target_host=target_host,
            )