InstallNixosVm

Install phase for a NixOS-backed VM on a Proxmox host. Idempotent. Creates the VM if missing, then runs the live-ISO install path (emit installer overlay + scp + install.sh + detach iso + power-cycle). Skips entirely when the guest agent reports the installed hostname (== machine.Name) - drift correction is handled by UpdateNixosVm, not here.

public static class InstallNixosVm

1. Methods

1.1. Run(Host, SystemManagement.Entities.Machine, NETSetupConfig, ISystemHost, IQmExecutor, NixHostTemplate)

Production entry. Wires the same real delegates as the original ProvisionNixosVm.Run install half: createVm/discoverIp/emit/remoteInstall.

public static InstallNixosVmResult Run(Host proxmoxHost, SystemManagement.Entities.Machine machine, NETSetupConfig config, ISystemHost sysHost, IQmExecutor qm = null, NixHostTemplate templateOverride = null)
Table 1. Parameters
Name Type Description

proxmoxHost

Host

machine

SystemManagement.Entities.Machine

config

NETSetupConfig

sysHost

ISystemHost

qm

IQmExecutor

Routes qm at the Proxmox host. Null (production, netsetup running ON the host) uses LocalQmExecutor. A dev box passes ProxmoxSshQmExecutor.

templateOverride

NixHostTemplate

Returns: InstallNixosVmResult

1.2. RunCore(SystemManagement.Entities.Machine, Func<bool>, Action<string>, Func<IPAddress>, Action<AbsolutePath>, Action<IPAddress, AbsolutePath>, ILogger)

Testable core. Each external action is a delegate seam unit tests can stub.

public static InstallNixosVmResult RunCore(SystemManagement.Entities.Machine machine, Func<bool> vmExists, Action<string> createVm, Func<IPAddress> discoverIp, Action<AbsolutePath> emitConfigBundle, Action<IPAddress, AbsolutePath> remoteInstall, ILogger logger)
Table 2. Parameters
Name Type Description

machine

SystemManagement.Entities.Machine

vmExists

Func<bool>

createVm

Action<string>

discoverIp

Func<IPAddress>

emitConfigBundle

Action<AbsolutePath>

remoteInstall

Action<IPAddress, AbsolutePath>

logger

ILogger

Returns: InstallNixosVmResult