Summary

Holonix is a cornerstone of our support for Holochain development. In this update, we’ll take a closer look at why we’ve introduced it as our go-to approach and how it can benefit you in building awesome applications with Holochain. We’ll also provide an overview of our custom operating system for HoloPorts.

Highlights

1. NixOS, Holonix, and The Connection to HoloPorts
2. Three Major Benefits of Holonix
3. Introducing HoloPortOS — NixOS on HoloPorts

Details

Holochain Dev Pulse July 1–July 8, 2019

1. NixOS, Holonix, and The Connection to HoloPorts

Our HoloPort devices run on HoloPortOS, which is a customized build of NixOS, which in turn is a Linux distribution powered by the Nix package manager. We’ve found that NixOS gives strong, clear states and dependency information — a lot like using Git and its hash trees. We’ve also encountered a very supportive community, which has helped us answer questions, troubleshoot issues, and learn valuable lessons.

Git

However, we realized that out-of-the-box NixOS wouldn’t be able to handle the complexities of managing all the components of Holochain (e.g., Node.JS, Rust cargo containers, compiling hApps to WASM). Versioning conflicts, for example, would pop up everywhere.

In response, we have introduced Holonix, a standard set of NixOS configurations that make development and testing easier across the Holochain ecosystem. It’s a massive framework that we’ve been working on for a while — each part is a huge undertaking and would comprise the entire business of other projects.

Therefore, we’d like to go into more detail about why we’ve gone in this direction, and why we are encouraging Holochain developers to use Holonix.

2. The Three Major Benefits of Holonix

Cross-Platform Support

The first benefit is the ease with which it enables developers to get set up on all major platforms. As we’ve mentioned before, we expect developers will be using Linux, MacOS, or Windows for development. We also know the Rust language moves fast; consequently, so does Holochain and the HDK for zome developers.

In more traditional frameworks, onboarding developers and keeping them up-to-date with the right environment becomes a huge challenge. We don’t have, nor do we want, any control over your machine or what you build. However with Holonix, as long as you track a tagged release or commit from Holonix in your codebase, you will always track working dependencies from Holochain Core and can even roll back or across to older or branched snapshots of dependencies.

Your dependencies can’t get out of sync — they are rescanned by hash (similar to Holochain zomes) each time you drop into a new terminal shell and cleaned up automatically when you finish work.

Standardized, Hassle-Free Tools

The second major benefit is the standardization of tools used by developers across platforms. As we are building fully distributed, P2P systems, we want everyone to be up and running with automated unit testing as soon as they run “init” on a new app. Nix-shell requires minimal modifications to the host environment. Importantly, as dependencies are hashed, the notorious “dependency hell” is avoided.

Standardization of Tools

When building a DNA, for example, if there is a change in any of its dependencies or in the build setup, you’ll get a different hash — so if you want to build the same DNA with the exact same output, you need a guaranteed stable environment to do that.

Holonix allows you to simply install nix-shell to set up the environment and all the dependencies will be taken care of, with no need to maintain or fix installation scripts.

This is one of the motivations for making it not only part of the Holochain Core developer experience, but also the Holochain App developer experience.

Easy to Customize and Extend Functionality

Thirdly, a major benefit of Holonix is the ability to extend and customize the OS for your own projects. You can extend the Holonix shell with your own shell scripts for testing and deployments, while tracking all the same upstream CI/environment management as everyone else. NixOS derivations are simple, but complete, functional programming languages.

For example, you can merge your own configurations into ours (it’s just a set) or append additional dependencies (it’s just a list), like electron, to build yourself a GUI. Even Holochain Core follows this pattern — it references Holonix for basic Rust/Node.JS setup, then extends the list of commands to add the scripts required to test and build Holochain for releases.

In short, if you have a nix-friendly system, this is the fastest and most reliable way to develop and test.

You might ask, “But what about Windows?” Rest assured, Native Windows support is under active development! In the meantime, you can use the Vagrant-based installer to install NixOS as a virtual machine. Docker is also an installation option, but it requires a Windows Pro/Enterprise/Education License.

3. Introducing HoloPortOS — NixOS on HoloPorts

As mentioned, the NixOS version we’re using for HoloPorts is a customized build we call HoloPortOS. Although we needed to make additional customizations through the Holonix suite, the reason we went with NixOS in the first place was that it offers superior solutions to a number of different issues, including:

NixOS

Unified Management

One of the core challenges of fully distributed, P2P systems is that all peers need to be speaking precisely the same protocols to each other in order to coordinate.

NixOS ensures everyone is running the exact same versions on the same network (e.g., Alpha-testnet, Betanet, Mainnet). No other large-scale, open-source, proven-in-the-real-world operating system project really offers the tools for managing automated updating and self-configuration that NixOS achieves.

Automated Updates

NixOS relies on a Hydra server, which serves as the distribution point for updates to the HoloPorts. Hydra is a tool for continuous integration testing, meaning we can have the application regularly take the source code of a project, build it, test it, and generate reports. This helps catch potential bugs before they go into production. Hydra can go from build to release for a variety of platforms in a fraction of the time it would take to do so manually.

Testnet

Increased Security

NixOS doesn’t run unknown executables. Therefore, even if Linux, Holochain, or some web component had a vulnerability that ended up letting someone push an executable file onto the system, it wouldn’t run. It has to have been compiled and hashed into the NixStore for NixOS to execute.

Troubleshooting & Tech Support

If someone makes custom changes to their system that break the HoloPort configuration, we can roll back to a known state (via a NixStore hash) and roll forward with updates. This takes a lot of the confusion and mystery out of tech support, making it feasible for us to support thousands of devices for end users.

ARM 64 Architectures

We’ve funded and helped update NixOS to function on several platforms, beginning with our own HoloPort Nano, based on a Banana Pi. As many people have wondered, we do plan to have it run on Raspberry Pis, tablets, cell phones, and other single board computers.

Hardware-Based Device and Cloud Images

Not only does NixOS run on HoloPort hardware, but it can also provide machine images to run on cloud infrastructure. NixOps is a set of DevOp tools to help automate cloud installs.

Jobset holoportOs-testnet

We’ve been amazed at the support we’ve received from the NixOS community as we’ve developed Holonix and HoloPortOS.

We once again want to give them a big shout-out, particularly to Yegor Timoshenko, for helping us work through some of the thornier aspects of the process. We also want to acknowledge the help of Ed Vielmetti at Packet.net.

Development Status:

Note: Updates and changes in Release 0.0.22-alpha1 will be discussed in next week’s Dev Pulse.

Building with Holochain? We want to hear from you!

Are you building with Holochain? We would love to connect and hear more about your app/platform. Please, take a few moments to fill out this survey! Our goal is to list all the projects building on Holochain on our forum.