fix: copy role-state.nix and custom.nix to host /etc/nixos before nixos-install

Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/38396f35-c812-43e5-9bf0-f7bd611cbba7

Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-05 16:54:29 +00:00
committed by GitHub
parent 35569e6ec0
commit 37ad4fd2ad

View File

@@ -876,6 +876,14 @@ class InstallerWindow(Adw.ApplicationWindow):
if not os.path.exists(f): if not os.path.exists(f):
raise RuntimeError(f"Required file missing: {f}") raise RuntimeError(f"Required file missing: {f}")
# The flake.nix imports /etc/nixos/role-state.nix and /etc/nixos/custom.nix
# as absolute paths. With --impure, Nix resolves these on the live ISO host,
# not under /mnt. Copy them so they exist on the host filesystem too.
GLib.idle_add(append_text, buf, "Copying config files to host /etc/nixos for flake evaluation...\n")
run(["sudo", "mkdir", "-p", "/etc/nixos"])
run(["sudo", "cp", "/mnt/etc/nixos/role-state.nix", "/etc/nixos/role-state.nix"])
run(["sudo", "cp", "/mnt/etc/nixos/custom.nix", "/etc/nixos/custom.nix"])
run_stream([ run_stream([
"sudo", "nixos-install", "sudo", "nixos-install",
"--root", "/mnt", "--root", "/mnt",