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