10 may 2011
running nix os [1] on a hetzner [2] platform using:
create a new virtual machine in virtualbox
use the ‘nix os minimal installation cd’ iso image and boot it
follow the nixos installation guide at [3] (no need for any raid setup here!)
(DON’T FORGET TO ENABLE SSHD IN /mnt/etc/nixos/configuration.nix before doing nixos-install)
services.sshd.enable = true;
the mountPoint can be set using labels:
{ mountPoint = “/”; label=“nixos”; };
in case you want to use a different version of grub you can add a line like this to configuration.nix:
nixpkgs.config.packageOverrides = pkgs : rec { grub2 = pkgs.grub198; };
if the ‘grub’ installation step failed this is not critical (at this point) we don’t need a bootable virtualbox image; we only need the files!
after the installation finished, don’t reboot (extract the files instead):
now you ‘could’ remove the virtualbox image, we don’t need it anymore.
mount LABEL=nixos /mnt
cd /mnt
wget http://lastlog.de/misc/nixos-2011-05-08.tar.gz
i copied this file (created earlier in this documentation) to my other root-server, don’t use it: USE YOUR OWN FILES
tar xzf nixos-2011-05-08.tar.gz
and all needed files are there.
Note: there are no /dev; /sys; or /proc files contained in the tar file! this is intentional
Note: in case you don’t have a place to put that nixos-*.tar.gz you can copy it to your machine using scp
the rescue image is based on debian and therefore we can use apt-get to install grub2!
apt-get install grub2
grub-install --no-floppy --root-directory=/mnt /dev/sda
grub-install --no-floppy --root-directory=/mnt /dev/sdb
add your public ssh key to /mnt/root/.ssh/authorized_keys
mkdir /mnt/root/.ssh
vi /mnt/root/.ssh/authorized_keys
copy'n'paste your pubkey
create a key pair if you don’t have already: ssh-keygen
it’s wise to disable the hard-drive write caches to avoid data loss on a power fail, so add this to your /etc/nixos/configuration.nix:
powerManagement.powerUpCommands="/var/run/current-system/sw/sbin/hdparm -W 0 /dev/sda /dev/sdb";
note: this can reduce throughput but i think it’s totally worth it.
one the client machine (which is used to connect to the hetzner nix os installation later) configure ~/.ssh/config:
Host nixos
hostname 88.198.52.216
User root
IdentityFile ~/.ssh/id_rsa_nixos
finally type:
ssh nixos
and you should get a nixos shell!
to debug the setup you can use tools like: