Merge pull request #167 from naturallaw777/copilot/fix-system-integrity-check

Fix: Running System Match always fails due to cwd-relative result symlink
This commit is contained in:
Sovran_Systems
2026-04-08 22:03:36 -05:00
committed by GitHub

View File

@@ -3088,13 +3088,12 @@ async def api_security_verify_integrity():
try: try:
current_system_path = os.path.realpath("/run/current-system") current_system_path = os.path.realpath("/run/current-system")
result = subprocess.run( result = subprocess.run(
["/run/current-system/sw/bin/nixos-rebuild", "build", "--flake", "/etc/nixos", "--no-build-output"], ["/run/current-system/sw/bin/nixos-rebuild", "build", "--flake", "/etc/nixos",
"--no-build-output", "--print-out-paths"],
capture_output=True, text=True, timeout=600, capture_output=True, text=True, timeout=600,
) )
if result.returncode == 0: if result.returncode == 0:
# nixos-rebuild build creates ./result symlink in cwd expected_system_path = result.stdout.strip()
result_path = os.path.realpath("result")
expected_system_path = result_path
system_matches = (current_system_path == expected_system_path) system_matches = (current_system_path == expected_system_path)
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
expected_system_path = "Build timed out" expected_system_path = "Build timed out"