JSON Schema The Horizon system supports converting JSON files to HorizonScript. This chapter describes the JSON schema supported by the Horizon JSON tooling. It is important to note that not all features of Horizon are available from JSON. For more advanced use cases, consider writing HorizonScript files directly. However, it is felt that supporting JSON interchange is important for interoperability with external systems.
Overall document structure There are two document formats supported by the Horizon JSON tooling. The most common is a simple structure where a single root object contains the Horizon JSON keys. The second, and less common, describes multiple configurations called "images" in a single JSON file. The root object contains a single key/value pair, images, which is an array of objects containing Horizon JSON keys. See for more information.
Supported keys
<literal>hostname</literal> Format String Short Description The device's host name. Corresponding HorizonScript key hostname
<literal>packages</literal> Format Array of String Short Description A list of packages to install to the device. Corresponding HorizonScript key pkginstall
<literal>rootpw</literal> Format String Short Description The encrypted root password for the device. Corresponding HorizonScript key rootpw
<literal>arch</literal> Format String Short Description The device's CPU architecture. Corresponding HorizonScript key arch
<literal>language</literal> Format String Short Description The language to use for the device's interface. Corresponding HorizonScript key language
<literal>keymap</literal> Format String Short Description The keyboard map to use for the device's hardware inputs. Corresponding HorizonScript key keymap
<literal>firmware</literal> Format String or Boolean Short Description Determines whether or not the device will have non-free firmware installed. Corresponding HorizonScript key firmware
<literal>services</literal> Format Array of Object Short Description Specifies additional services to start on device boot. Object Structure service (String) The name of the service to start. runlevel (String) The runlevel that the service should start under. If no runlevel is specified, default is used. Corresponding HorizonScript key svcenable
<literal>netconfig</literal> Format String Short Description Determines the network configuration system used on the device. Corresponding HorizonScript key netconfigtype
<literal>netaddresses</literal> Format Array of Object Short Description Specifies the device's network addressing configuration. Object Structure id (String) This connection's identifier. This field is for operator reference only - it will not appear in the HorizonScript or in the device's configuration. interface (String) The network interface to use for this address. addr-type (String) The type of this address: none to bring up the interface without an address (common for bridging), dhcp for DHCP, or static for static addressing. address (Object) The network address. Only valid if addr-type is static. If static addressing is desired, the address object is described below. ip-address (String) The IPv4 or IPv6 address for this connection. net-prefix (Number) The network prefix for this connection. Valid values are 1-32 for IPv4, and 1-128 for IPv6. gateway (String) The IPv4 or IPv6 address for the gateway for this connection. Corresponding HorizonScript key netaddress
<literal>nameservers</literal> Format Array of String Short Description IP addresses used for Domain Name System (DNS) resolution. Corresponding HorizonScript key nameserver
<literal>access-points</literal> Format Array of Object Short Description Specifies the device's wireless networking configuration. Object Structure interface (String) The wireless network interface to use for this access point. ssid (String) The SSID for this access point. security (String) The security type to use for this access point: none, wep, or wpa. password (String) The shared secret to use for authenticating this wireless link. Corresponding HorizonScript key netssid
<literal>timezone</literal> Format String Short Description The time zone to use on the device. Corresponding HorizonScript key timezone
<literal>repositories</literal> Format Array of String Short Description The APK repositories to use for package installation on the device. Corresponding HorizonScript key repository
<literal>signingkeys</literal> Format Array of String Short Description The location of the signing key(s) used by the device's APK repositories. Corresponding HorizonScript key signingkey
<literal>users</literal> Format Array of Object Short Description Specifies the device's user accounts. Object Structure username (String) The login name of this account. alias (String) The friendly name/GECOS of this account. passphrase (String) The encrypted passphrase to use to authenticate to this account. See for information about the format of passphrase. groups (String) Comma-separated list of this account's member groups. Corresponding HorizonScript keys username, useralias, userpw, usergroups
Examples Basic example of Horizon JSON file { "hostname": "horizon-json-testmachine.adelielinux.org", "packages": ["adelie-base-posix", "easy-kernel", "easy-kernel-modules", "netifrc", "openrc", "s6-linux-init"], "rootpw": "...", "root": "/dev/sda1", "netaddresses": [{"id":"eth0", "interface":"eth0", "addr-type":"dhcp"}], "nameservers": ["9.9.9.9"], "timezone": "America/Chicago", "repositories": ["https://distfiles.adelielinux.org/adelie/1.0/system", "https://distfiles.adelielinux.org/adelie/1.0/user"], "signingkeys": ["/etc/apk/keys/powerpc-1@packages.adelielinux.org.pub", "/etc/apk/keys/powerpc-2@packages.adelielinux.org.pub"] } Example of multi-configuration Horizon JSON file {"images": [ {"name": "Test Image", "hostname": "horizon-json-testmachine.adelielinux.org", "packages": ["adelie-base-posix", "easy-kernel", "easy-kernel-modules", "netifrc", "openrc", "s6-linux-init"], "rootpw": "...", "root": "/dev/sda1", "arch": "ppc64", "language": "en_GB.UTF-8", "keymap": "us", "firmware": false, "netconfig": "netifrc", "netaddresses": [{"id":"eth0", "interface":"eth0", "addr-type":"dhcp"}], "nameservers": ["9.9.9.9"], "timezone": "America/Chicago", "repositories": ["https://distfiles.adelielinux.org/adelie/1.0/system", "https://distfiles.adelielinux.org/adelie/1.0/user"], "signingkeys": ["/etc/apk/keys/powerpc-1@packages.adelielinux.org.pub", "/etc/apk/keys/powerpc-2@packages.adelielinux.org.pub"] } ] }