nixos-rebuild-ng: use Path.resolve() instead of readlink() (#384060)

This commit is contained in:
Thiago Kenji Okada
2025-02-22 10:33:25 +00:00
committed by GitHub
2 changed files with 2 additions and 3 deletions
@@ -140,8 +140,7 @@ class Flake:
default_path = Path("/etc/nixos/flake.nix")
if default_path.exists():
# It can be a symlink to the actual flake.
if default_path.is_symlink():
default_path = default_path.readlink()
default_path = default_path.resolve()
return cls.parse(str(default_path.parent), get_hostname)
else:
return None
@@ -140,7 +140,7 @@ def test_flake_from_arg(
return_value=True,
),
patch(
get_qualified_name(m.Path.readlink, m),
get_qualified_name(m.Path.resolve, m),
autospec=True,
return_value=Path("/path/to/flake.nix"),
),