5   clientKeyPath = "/root/.vbox-nixops-client-key";
 
  10   imports = [ <nixpkgs/nixos/modules/virtualisation/virtualbox-image.nix> ];
 
  12   services.openssh.enable = true;
 
  14   systemd.services.get-vbox-nixops-client-key = {
 
  15     description = "Get NixOps SSH Key";
 
  16     wantedBy = [ "multi-user.target" ];
 
  17     before = [ "sshd.service" ];
 
  18     requires = [ "dev-vboxguest.device" ];
 
  19     after = [ "dev-vboxguest.device" ];
 
  20     path = [ config.boot.kernelPackages.virtualboxGuestAdditions ];
 
  23       VBoxControl -nologo guestproperty get /VirtualBox/GuestInfo/Charon/ClientPublicKey | sed 's/Value: //' > ${clientKeyPath}.tmp
 
  24       mv ${clientKeyPath}.tmp ${clientKeyPath}
 
  26       if [[ ! -f /etc/ssh/ssh_host_ed25519_key ]]; then
 
  27         VBoxControl -nologo guestproperty get /VirtualBox/GuestInfo/NixOps/PrivateHostEd25519Key | sed 's/Value: //' > /etc/ssh/ssh_host_ed25519_key.tmp
 
  28         mv /etc/ssh/ssh_host_ed25519_key.tmp /etc/ssh/ssh_host_ed25519_key
 
  29         chmod 0600 /etc/ssh/ssh_host_ed25519_key
 
  34   services.openssh.authorizedKeysFiles = [ ".vbox-nixops-client-key" ];
 
  38   boot.loader.timeout = 1;
 
  40   # VirtualBox doesn't seem to lease IP addresses persistently, so we
 
  41   # may get a different IP address if dhcpcd is restarted.  So don't
 
  43   systemd.services.dhcpcd.restartIfChanged = false;
 
  45   # Useless there and CPU intensive.
 
  46   documentation.nixos.enable = false;