1 import Base 2 import ./host/type.bend as H 3 import ./nix_darwin/type.bend as ND 4 import ./azure/type.bend as Az 5 import ./launchd/type.bend as Ld 6 7 # A device is someone's own (a phone, a laptop); a server runs the system for others. 8 type Role is Data: 9 Device{} 10 Server{} 11 12 # What configures a node: nothing V manages, nix-darwin, an Azure subscription, or only the launch agents and 13 # Tailscale serves V declares on a Mac something else configures. 14 type Platform is Data: 15 Unmanaged{} 16 Darwin{config: ND.NixDarwin} 17 AzureCloud{config: Az.Azure} 18 Launchd{config: Ld.Launchd} 19 20 # Where containers run: a machine, a runtime inside it, nested as deep as it is. Instances are container keys. 21 type Node is Data: 22 Node{key: String, name: String, technology: String, role: Role, host: H.Host, platform: Platform, children: List<&2, Node>, instances: List<&2, String>} 23 24 # What a deploy breaks, compared with what was deployed before. 25 type Break is Data: 26 AddressChanged{} 27 StoreRemoved{name: String} 28 29 # Where the system runs: the address it is reached at, the data stores that must survive a deploy, the 30 # breaks accepted for the next deploy, and the nodes. 31 type Deployment is Data: 32 Deployment{address: String, stores: List<&2, String>, accepted: List<&2, Break>, nodes: List<&2, Node>}