NixNextcloudTemplate
Nextcloud-on-NixOS template. Ported from nixos/hosts/default-nextcloud/default.nix.
public sealed class NixNextcloudTemplate : NixHostTemplate
1. Properties
1.1. AuthorizedKeys
Authorized SSH public keys (one per line).
public IReadOnlyList<string> AuthorizedKeys { get; set; }
1.2. CustomerDomain
Customer mail/dns domain. Used to stamp trusted_domains + overwritehost so the Traefik subdomain path on the dns VM works end-to-end.
public string CustomerDomain { get; set; }
1.3. DiskDevice
Install-target block device (e.g. /dev/sda, /dev/vda).
public string DiskDevice { get; set; }
1.4. Gateway
Default gateway for static IPv4. Auto-derived from StaticIPv4 (.1) when null.
public string Gateway { get; set; }
1.5. Hostname
Target hostname.
public MachineName Hostname { get; set; }
1.6. Nameservers
DNS servers used with static IPv4. Default falls back to gateway.
public IReadOnlyList<string> Nameservers { get; set; }
1.7. 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.8. RecommendedCpuCores
4 vCPUs — php-fpm + closure-build parallelism.
public override uint RecommendedCpuCores { get; }
1.9. RecommendedDiskGib
Nextcloud needs ~256 GiB (php-fpm closure build OOMs disk at 64 GiB).
public override int RecommendedDiskGib { get; }
1.10. RecommendedMemoryGib
8 GiB RAM — closure build OOMs with less; php-fpm headroom at runtime.
public override int RecommendedMemoryGib { get; }
1.11. RecommendedSwapMib
16 GiB swapfile — Nextcloud working set under load can spike past RAM.
public override int RecommendedSwapMib { get; }
1.12. StaticIPv4
Static IPv4 to assign to the primary NIC (e.g. "192.168.1.183"). Null/empty → DHCP.
public string StaticIPv4 { get; set; }
1.13. StaticIPv4Prefix
Static IPv4 prefix length when StaticIPv4 is set. Default /24.
public int StaticIPv4Prefix { get; set; }
1.14. TimeZone
IANA time zone.
public string TimeZone { get; set; }
1.15. 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>