1<section xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
3 xmlns:xi="http://www.w3.org/2001/XInclude"
4 version="5.0"
5 xml:id="sec-instaling-virtualbox-guest">
6
7<title>Installing in a Virtualbox guest</title>
8<para>
9 Installing NixOS into a Virtualbox guest is convenient for users who want to
10 try NixOS without installing it on bare metal. If you want to use a pre-made
11 Virtualbox appliance, it is available at <link
12 xlink:href="https://nixos.org/nixos/download.html">the downloads page</link>.
13 If you want to set up a Virtualbox guest manually, follow these instructions:
14</para>
15
16<orderedlist>
17
18 <listitem><para>Add a New Machine in Virtualbox with OS Type "Linux / Other
19 Linux"</para></listitem>
20
21 <listitem><para>Base Memory Size: 768 MB or higher.</para></listitem>
22
23 <listitem><para>New Hard Disk of 8 GB or higher.</para></listitem>
24
25 <listitem><para>Mount the CD-ROM with the NixOS ISO (by clicking on
26 CD/DVD-ROM)</para></listitem>
27
28 <listitem><para>Click on Settings / System / Processor and enable
29 PAE/NX</para></listitem>
30
31 <listitem><para>Click on Settings / System / Acceleration and enable
32 "VT-x/AMD-V" acceleration</para></listitem>
33
34 <listitem><para>Save the settings, start the virtual machine, and continue
35 installation like normal</para></listitem>
36
37</orderedlist>
38
39<para>
40 There are a few modifications you should make in configuration.nix. Enable
41 the virtualbox guest service in the main block:
42</para>
43
44<programlisting>
45virtualisation.virtualbox.guest.enable = true;
46</programlisting>
47
48<para>
49 Enable booting:
50</para>
51
52<programlisting>
53boot.loader.grub.device = "/dev/sda";
54</programlisting>
55
56<para>
57 Also remove the fsck that runs at startup. It will always fail to run,
58 stopping your boot until you press <literal>*</literal>.
59</para>
60
61<programlisting>
62boot.initrd.checkJournalingFS = false;
63</programlisting>
64
65<para>
66 Shared folders can be given a name and a path in the host system in the
67 VirtualBox settings (Machine / Settings / Shared Folders, then click on the
68 "Add" icon). Add the following to the
69 <literal>/etc/nixos/configuration.nix</literal> to auto-mount them:
70</para>
71
72<programlisting>
73{ config, pkgs, ...} :
74{
75 ...
76
77 fileSystems."/virtualboxshare" = {
78 fsType = "vboxsf";
79 device = "nameofthesharedfolder";
80 options = [ "rw" ];
81 };
82}
83</programlisting>
84
85<para>
86 The folder will be available directly under the root directory.
87</para>
88
89</section>