NixTemplateFactory

Resolves the concrete NixHostTemplate for a given Machine based on its OperatingSystem.

public static class NixTemplateFactory

1. Methods

1.1. ForMachine(IMachine)

Returns a concrete template matching machine.OperatingSystem. Accepts any IMachine implementation (supports both Contracts.Machine and Entities.Machine).

public static NixHostTemplate ForMachine(IMachine machine)
Table 1. Parameters
Name Type Description

machine

IMachine

Returns: NixHostTemplate

1.2. ForMachine(IMachine, NETSetupConfig)

Returns a concrete template matching machine.OperatingSystem and wires customer-domain / relay / dns-provider configuration from config onto the template (NixMail / NixDns concrete subclasses). Falls back to config.DirectoryService.Name.Value when config.CustomerDomain is unset.

public static NixHostTemplate ForMachine(IMachine machine, NETSetupConfig config)
Table 2. Parameters
Name Type Description

machine

IMachine

config

NETSetupConfig

Returns: NixHostTemplate

1.3. ForMachine(IMachine, NETSetupConfig, IReadOnlyDictionary<string, string>)

Returns a concrete template matching machine.OperatingSystem and wires customer-domain / relay / dns-provider configuration from config onto the template (NixMail / NixDns concrete subclasses).

When dnsIpOverrides is non-null and the template is NixDnsTemplate, the supplied map replaces the empty-string placeholder IPs from BuildDnsTopology(NETSetupConfig, string) for matching record keys, so coredns serves LAN A records for sibling hosted VMs. Keys are the lowercase hostname (DnsKey), values are IPv4 strings. Keys absent from the map fall back to the empty placeholder (ddns-updater pushes runtime public IP).

public static NixHostTemplate ForMachine(IMachine machine, NETSetupConfig config, IReadOnlyDictionary<string, string> dnsIpOverrides)
Table 3. Parameters
Name Type Description

machine

IMachine

config

NETSetupConfig

dnsIpOverrides

IReadOnlyDictionary<string, string>

Returns: NixHostTemplate

1.4. ForMachine(Machine)

Returns a concrete template matching machine.OperatingSystem. Throws NETSetupException for non-nix OS.

public static NixHostTemplate ForMachine(Machine machine)
Table 4. Parameters
Name Type Description

machine

Machine

Returns: NixHostTemplate

1.5. PublicDnsKey(string)

Returns the lowercase first-segment hostname used as the dns record key (e.g. "nextcloud@HOST" → "nextcloud"). Public so callers building dns IP overrides (see EnsureCustomerVms) match the same key convention as BuildDnsTopology(NETSetupConfig, string).

public static string PublicDnsKey(string machineName)
Table 5. Parameters
Name Type Description

machineName

string

Returns: string

1.6. ResolveDnsServerIp(NETSetupConfig)

Returns the IPv4 of the Nix Dns VM (Machine with OS=NixDns and non-None static IP), or null when no such machine is defined. Used by templates to wire networking.nameservers on sibling Nix VMs and by Windows/Proxmox stages to set their resolvers.

public static string ResolveDnsServerIp(NETSetupConfig config)
Table 6. Parameters
Name Type Description

config

NETSetupConfig

Returns: string

1.7. ResolveMailServerIp(NETSetupConfig)

Returns the IPv4 of the Nix Mail VM (Machine with OS=NixMail and non-None static IP), or null when no such machine is defined. Mirrors ResolveDnsServerIp(NETSetupConfig). Used by the PMG LXC relay step to point PMG’s transport/relay at the mail backend by IP (NOT hostname) so the inbound 25 → PMG → mail hop has no DNS dependency.

public static string ResolveMailServerIp(NETSetupConfig config)
Table 7. Parameters
Name Type Description

config

NETSetupConfig

Returns: string

1.8. ResolvePmgIp(NETSetupConfig)

Resolves the PMG LXC LAN IP from the configured machines. Mirror of ResolveMailServerIp(NETSetupConfig): scans config.DirectoryService.Machines, picks the first PmgLxc entry with a non-None IP. Returns null when no PMG LXC is present or its IP is unresolved (first-cycle install before DHCP assignment).

public static string ResolvePmgIp(NETSetupConfig config)
Table 8. Parameters
Name Type Description

config

NETSetupConfig

Returns: string