Installing NixOS on OVH dedicated servers

I recently setup a AMD Ryzen 7 3700 PRO dedicated server at OVHcloud with #NixOS. I used the NIXOS_LUSTRATE method of installing from an existing Linux install. This is just a brief overview of what I did for posterity:

  1. Install Debian 9 from OVH control panel
  2. Follow the NIXOS_LUSTRATE specific instructions at 2.5.4. Installing from another Linux distribution
  3. Before the nixos-generate-config step, you must do the following:
    1. Fix boot partitions: YMMV, but I had to nuke /boot and remount /boot/efi back at /boot
    2. Static IP network configuration: I had to configure these:1:
      • My OVH server has a static IP and does not use DHCP
        • Gateway address and name servers
      • As networking.usePredictableInterfaceNames is enabled by default on NixOS, the kernel will assign a predictable interface name to the local network interface (eg: enp1s0f0 instead of eth0); so use that in the static networking config.
  4. Once configuration.nix is generated, edit it and add your ssh key to the root user.
  5. Continue with the lustrate instructions as documented.

Reboot, and enjoy your fresh serving of remote NixOS.

Alternative methods

  • nixos-install-scripts
  • clever on IRC recommends kexec which obviates the step 1 above, allowing you to do a fresh install of NixOS from the rescue boot session.
  1. For the record, my configuration looks like this:

    # /etc/nixos/configuration.nix
    networking.useDHCP = false;
    networking.defaultGateway = "";
    networking.nameservers = [ "" ];
    networking.interfaces."enp1s0f0".ipv4.addresses = [
        address = "";
        prefixLength = 24;