NixGenericTemplate
Generic NixOS host template for plain OS.NixOS (no service preset).
public sealed class NixGenericTemplate : NixHostTemplate
1. Properties
1.1. AuthorizedKeys
Authorized SSH public keys (one per line).
public IReadOnlyList<string> AuthorizedKeys { get; set; }
1.2. DiskDevice
Install-target block device (e.g. /dev/sda, /dev/vda).
public string DiskDevice { get; set; }
1.3. Gateway
Default gateway for static IPv4. Auto-derived from StaticIPv4 (.1) when null.
public string Gateway { get; set; }
1.4. Hostname
Target hostname.
public MachineName Hostname { get; set; }
1.5. Nameservers
DNS servers used with static IPv4. Default falls back to gateway.
public IReadOnlyList<string> Nameservers { get; set; }
1.6. Password
Initial password applied to root + admin user (users.users.<name>.initialPassword). Defaults to the central NETSetup admin password so SSH key auth and console login both work with the same value across Windows/Nix/PMG provisioning.
public string Password { get; set; }
1.7. RecommendedCpuCores
Recommended runtime vCPU count. Default 2 (mail/dns/generic). Nextcloud overrides to 4 because php-fpm + nix-install closure builds saturate fewer cores.
public virtual uint RecommendedCpuCores { get; }
1.8. RecommendedDiskGib
Recommended VM disk size in GiB. Nextcloud needs ~256 (closure build space); dns/mail/pmg fit comfortably in 32. Default 32; concrete templates override.
public virtual int RecommendedDiskGib { get; }
1.9. RecommendedMemoryGib
Recommended runtime RAM in GiB. Default 8. Nextcloud and IPFS keep the same value explicitly (php-fpm / the ipfs daemon need the headroom at runtime as well).
public virtual int RecommendedMemoryGib { get; }
1.10. RecommendedSwapMib
Steady-state swapfile size in MiB written to /var/swapfile. Default 8192 (8 GiB). Tight RAM (Mail/Dns at 2 GiB) makes runtime OOM likely under load — swap is slow but keeps services alive. Nextcloud overrides to 16 GiB given larger working set.
public virtual int RecommendedSwapMib { get; }
1.11. StaticIPv4
Static IPv4 to assign to the primary NIC (e.g. "192.168.1.183"). Null/empty → DHCP.
public string StaticIPv4 { get; set; }
1.12. StaticIPv4Prefix
Static IPv4 prefix length when StaticIPv4 is set. Default /24.
public int StaticIPv4Prefix { get; set; }
1.13. TimeZone
IANA time zone.
public string TimeZone { get; set; }
1.14. UserName
Default admin user.
public string UserName { get; set; }
2. Methods
2.1. GenerateDefaultNix()
Host default.nix content. Concrete per template.
public override string GenerateDefaultNix()
Returns: string
2.2. GenerateFlakeNix()
flake.nix for this host.
public virtual string GenerateFlakeNix()
Returns: string
2.3. GenerateHardwareNix()
hardware.nix for this host.
public virtual string GenerateHardwareNix()
Returns: string
2.4. GenerateStaticNetworkBlock()
Returns the network nix snippet — ALWAYS emits host.system.network.dhcp.enable so individual templates must NOT repeat it (NixOS module eval treats duplicate attribute definitions within the same {} body as an "already defined" error, even when one is mkDefault and the other mkForce — priority modifiers only resolve cross-module conflicts, not intra-set duplicates). Emits the static-IPv4 block additionally when StaticIPv4 is set.
protected string GenerateStaticNetworkBlock()
Returns: string
2.5. GetRequiredSecrets(NETSetupConfig)
Extra sops secrets this template requires in the per-VM secrets.yaml (beyond the always-emitted luks password). Base returns none; concrete templates (e.g. NixIpfsTemplate) override to contribute nested/multiline entries.
public virtual IReadOnlyList<NixSecretEntry> GetRequiredSecrets(NETSetupConfig config)
| Name | Type | Description |
|---|---|---|
config |
NETSetupConfig |
Returns: IReadOnlyList<NixSecretEntry>