This little tutorial will show you how to turn an Ubuntu Droplet (VM) on DigitalOcean into a NixOS Droplet using nixos-infect. NixOS is a Linux distribution which is declaratively configured using a specification written in the Nix expression language describing the desired state of the system. It supports automatic upgrades and rollbacks.

Aside from DigitalOcean, you can run NixOS on most common computers. It’s possible to run NixOS on ARM64 computers, like on the Raspberry Pi 3.

In this tutorial we’ll transform Ubuntu 18.04 LTS into NixOS 19.09 Loris.

Prepare

Create a Droplet on DigitalOcean, I’d recommend a minimum of 2GB RAM, running Ubuntu 18.04 LTS.

Transform into NixOS

First, clone the nixos-infect repository:

$ git clone https://github.com/elitak/nixos-infect.git

Then simply run nixos-infect:

cd nixos-infect/
./nixos-infect

Give it some time and you’ll eventually have a NixOS installation on your Droplet. Please note that this is highly experimental and not something for any sort of production use.

There are loads of configuration options you can provide to nixos-infect and NixOS itself. Please refer to the nixos-infect documentation and the NixOS documentation.

Good luck! 😀