NixIpfsRole

The private-IPFS-cluster node expressed as DATA, using the entity model instead of a hand written NixIpfsTemplate subclass.

Note

This is the proof that the entity model is expressive enough for a real role, not just a toy node. Everything the hand written template hardcodes as nix text is here as a path/value pair: the encrypted disk with its nested btrfs retention block, the TPM auto unlock, the sops wiring and the vendor host.services.ipfsPrivateCluster tree.

Secrets are passed IN rather than read from config, because they are minted per cluster by IpfsClusterSecretsGenerator. Keeping the role a pure function of its inputs is what makes it unit-testable without a config.

public static class NixIpfsRole

1. Fields

1.1. ClusterSecretSopsPath

Sops path of the cluster secret. MUST match ipfs-private-cluster.nix.

public const string ClusterSecretSopsPath

1.2. DiskGib

System disk in GiB. The node stores its repo and cluster state on the system disk.

public const int DiskGib

1.3. MemoryGib

RAM in GiB. 2 GiB overflows while realising the kubo closure in the installer tmpfs.

public const int MemoryGib

1.4. SwarmKeySopsPath

Sops path of the swarm key. MUST match ipfs-private-cluster.nix.

public const string SwarmKeySopsPath

2. Methods

2.1. Build(string, string, string, string, IpfsClusterOptions)

Builds the IPFS role as a model.

public static NixHostModel Build(string hostname, string userName = "admin", string timeZone = "Europe/Zurich", string diskDevice = "/dev/sda", IpfsClusterOptions cluster = null)
Table 1. Parameters
Name Type Description

hostname

string

Target hostname.

userName

string

Admin user created on the host.

timeZone

string

IANA time zone.

diskDevice

string

Install-target block device.

cluster

IpfsClusterOptions

Cluster secrets; omit to build the role without secrets (render tests).

Returns: NixHostModel — The assembled host model.