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:
- Install Debian 9 from OVH control panel
- Follow the
NIXOS_LUSTRATE
specific instructions at 2.5.4. Installing from another Linux distribution - Before the
nixos-generate-config
step, you must do the following:- Fix boot partitions: YMMV, but I had to nuke
/boot
and remount/boot/efi
back at/boot
- 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 ofeth0
); so use that in the static networking config.
- My OVH server has a static IP and does not use DHCP
- Fix boot partitions: YMMV, but I had to nuke
- Once
configuration.nix
is generated, edit it and add your ssh key to the root user. - 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.
For the record, my configuration looks like this:
↩︎# /etc/nixos/configuration.nix networking.useDHCP = false; networking.defaultGateway = "51.123.22.213"; networking.nameservers = [ "8.8.8.8" ]; networking.interfaces."enp1s0f0".ipv4.addresses = [ { address = "51.133.22.209"; prefixLength = 24; } ];