Chris Martin

NixOS on DigitalOcean

How to start a new NixOS droplet on Digital Ocean using nixos-infect:

  1. Start an Ubuntu 16.04 droplet.
  2. Enable ipv6.
  3. Add your key to ~/.ssh/authorized_keys and SSH in as root.
  4. Download nixos-infect:
wget https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect
  1. Run nixos-infect:
bash nixos-infect
  1. NixOS will install (this takes a little while) and the machine will reboot.
  2. SSH in as root again.
  3. Update /etc/nixos/configuration.nix to set up things like SSH and users.
  4. Rebuild NixOS:
nixos-rebuild switch
  1. Use `passwd` to set user passwords. Remember to do this for at least one sudoer so you don’t lock yourself out of the machine!

I write about Haskell and related topics; you can find my works online on Type Classes and in print from The Joy of Haskell.