Merge pull request #169 from naturallaw777/copilot/fix-nixos-rebuild-result-symlink

[WIP] Fix missing result symlink in verify integrity check
This commit is contained in:
Sovran_Systems
2026-04-08 22:44:25 -05:00
committed by GitHub

View File

@@ -3091,14 +3091,14 @@ async def api_security_verify_integrity():
# Use a temp directory so the ./result symlink doesn't pollute anything # Use a temp directory so the ./result symlink doesn't pollute anything
tmpdir = tempfile.mkdtemp(prefix="sovran-verify-") tmpdir = tempfile.mkdtemp(prefix="sovran-verify-")
try: try:
result_link = os.path.join(tmpdir, "result")
result = subprocess.run( result = subprocess.run(
["/run/current-system/sw/bin/nixos-rebuild", "build", "--flake", "/etc/nixos", ["/run/current-system/sw/bin/nixos-rebuild", "build", "--flake", "/etc/nixos",
"--no-build-output"], "--no-build-output", "-o", result_link],
capture_output=True, text=True, timeout=600, capture_output=True, text=True, timeout=600,
cwd=tmpdir, cwd=tmpdir,
) )
if result.returncode == 0: if result.returncode == 0:
result_link = os.path.join(tmpdir, "result")
if os.path.islink(result_link): if os.path.islink(result_link):
expected_system_path = os.path.realpath(result_link) expected_system_path = os.path.realpath(result_link)
system_matches = (current_system_path == expected_system_path) system_matches = (current_system_path == expected_system_path)