NixHostModel

Declarative description of one NixOS host: what it IS, what it INSTALLS and what it RUNS.

Note

This is the data half of the entity model. It replaces "a role is a C# subclass" with "a role is a value you can build, inspect, diff and test". It deliberately mirrors the NixOS module system rather than inventing a parallel vocabulary:

  • Packages → environment.systemPackages

  • Services → services.<name>.*

  • Secrets → sops.secrets."<path>"

  • ExtraModules → module imports

Rendering lives in NixModelTemplate, so the model stays free of nix syntax.

public sealed class NixHostModel

1. Properties

1.1. CpuCores

vCPU count for the provisioned VM.

public uint CpuCores { get; set; }

1.2. DiskDevice

Install-target block device.

public string DiskDevice { get; set; }

1.3. DiskGib

System disk size in GiB for the provisioned VM.

public int DiskGib { get; set; }

1.4. ExtraModules

Extra module paths added to the host’s imports.

public IList<string> ExtraModules { get; }

1.5. ExtraNixLines

Verbatim nix lines appended to the host body, for anything the model cannot express.

public IList<string> ExtraNixLines { get; }

1.6. Gateway

Default gateway; derived from the static IPv4 when null.

public string Gateway { get; set; }

1.7. Hostname

Target hostname; also the flake output name.

public MachineName Hostname { get; set; }

1.8. MemoryGib

RAM in GiB for the provisioned VM.

public int MemoryGib { get; set; }

1.9. Nameservers

DNS servers used with a static IPv4.

public IReadOnlyList<string> Nameservers { get; set; }

1.10. Options

Arbitrary option assignments, keyed by full dotted option path, in declaration order.

public IList<KeyValuePair<string, NixValue>> Options { get; }

1.11. Packages

Packages added to environment.systemPackages.

public IList<NixPackage> Packages { get; }

1.12. Secrets

sops secrets this host requires, beyond the always-emitted luks password.

public IList<NixSecretEntry> Secrets { get; }

1.13. Services

Service blocks emitted under services..

public IList<NixService> Services { get; }

1.14. StaticIPv4

Static IPv4, or null/empty for DHCP.

public string StaticIPv4 { get; set; }

1.15. StaticIPv4Prefix

Prefix length used with StaticIPv4.

public int StaticIPv4Prefix { get; set; }

1.16. SwapMib

Steady-state swapfile size in MiB.

public int SwapMib { get; set; }

1.17. TimeZone

IANA time zone.

public string TimeZone { get; set; }

1.18. UserName

Primary admin user created on the host.

public string UserName { get; set; }