Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (27 sloc) 0.989 kb
f9b36aa @edolstra Use $NIX_PATH to locate the Charon Nix expressions
edolstra authored
1 { config, pkgs, ... }:
2
63ddb72 @edolstra VirtualBox backend: don't hard-code an SSH key into the image but genera...
edolstra authored
3 let
4
5 clientKeyPath = "/root/.vbox-client-key";
6
7 in
8
f9b36aa @edolstra Use $NIX_PATH to locate the Charon Nix expressions
edolstra authored
9 { require = [ <nixos/modules/virtualisation/virtualbox-image.nix> ];
10
11 services.openssh.enable = true;
12
63ddb72 @edolstra VirtualBox backend: don't hard-code an SSH key into the image but genera...
edolstra authored
13 jobs."get-vbox-charon-client-key" =
381303a @edolstra get-vbox-charon-client-key: Support systemd
edolstra authored
14 { task = true;
63ddb72 @edolstra VirtualBox backend: don't hard-code an SSH key into the image but genera...
edolstra authored
15 path = [ config.boot.kernelPackages.virtualboxGuestAdditions ];
16 exec =
17 ''
18 VBoxControl -nologo guestproperty get /VirtualBox/GuestInfo/Charon/ClientPublicKey | sed 's/Value: //' > ${clientKeyPath}
19 '';
381303a @edolstra get-vbox-charon-client-key: Support systemd
edolstra authored
20 } // (if config.system.build ? systemd then {
21 wantedBy = [ "sshd.service" ];
22 before = [ "sshd.service" ];
23 } else {
24 startOn = "starting sshd";
25 });
63ddb72 @edolstra VirtualBox backend: don't hard-code an SSH key into the image but genera...
edolstra authored
26
27 users.extraUsers.root.openssh.authorizedKeys.keyFiles = [ clientKeyPath ];
f9b36aa @edolstra Use $NIX_PATH to locate the Charon Nix expressions
edolstra authored
28
29 boot.vesa = false;
88b72d5 @edolstra Don't restart dhcpcd in VirtualBox instances
edolstra authored
30
3a3c858 @edolstra Minimise GRUB boot delay
edolstra authored
31 boot.loader.grub.timeout = 1;
32
88b72d5 @edolstra Don't restart dhcpcd in VirtualBox instances
edolstra authored
33 # VirtualBox doesn't seem to lease IP addresses persistently, so we
34 # may get a different IP address if dhcpcd is restarted. So don't
35 # restart dhcpcd.
36 jobs.dhcpcd.restartIfChanged = false;
f9b36aa @edolstra Use $NIX_PATH to locate the Charon Nix expressions
edolstra authored
37 }
Something went wrong with that request. Please try again.