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 <title>Installing in a VirtualBox guest</title>
7
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
12 <link
13 xlink:href="https://nixos.org/nixos/download.html">the downloads
14 page</link>. If you want to set up a VirtualBox guest manually, follow these
15 instructions:
16 </para>
17
18 <orderedlist>
19 <listitem>
20 <para>
21 Add a New Machine in VirtualBox with OS Type "Linux / Other Linux"
22 </para>
23 </listitem>
24 <listitem>
25 <para>
26 Base Memory Size: 768 MB or higher.
27 </para>
28 </listitem>
29 <listitem>
30 <para>
31 New Hard Disk of 8 GB or higher.
32 </para>
33 </listitem>
34 <listitem>
35 <para>
36 Mount the CD-ROM with the NixOS ISO (by clicking on CD/DVD-ROM)
37 </para>
38 </listitem>
39 <listitem>
40 <para>
41 Click on Settings / System / Processor and enable PAE/NX
42 </para>
43 </listitem>
44 <listitem>
45 <para>
46 Click on Settings / System / Acceleration and enable "VT-x/AMD-V"
47 acceleration
48 </para>
49 </listitem>
50 <listitem>
51 <para>
52 Save the settings, start the virtual machine, and continue installation
53 like normal
54 </para>
55 </listitem>
56 </orderedlist>
57
58 <para>
59 There are a few modifications you should make in configuration.nix. Enable
60 booting:
61 </para>
62
63<programlisting>
64<xref linkend="opt-boot.loader.grub.device"/> = "/dev/sda";
65</programlisting>
66
67 <para>
68 Also remove the fsck that runs at startup. It will always fail to run,
69 stopping your boot until you press <literal>*</literal>.
70 </para>
71
72<programlisting>
73<xref linkend="opt-boot.initrd.checkJournalingFS"/> = false;
74</programlisting>
75
76 <para>
77 Shared folders can be given a name and a path in the host system in the
78 VirtualBox settings (Machine / Settings / Shared Folders, then click on the
79 "Add" icon). Add the following to the
80 <literal>/etc/nixos/configuration.nix</literal> to auto-mount them:
81 </para>
82
83<programlisting>
84{ config, pkgs, ...} :
85{
86 ...
87
88 fileSystems."/virtualboxshare" = {
89 fsType = "vboxsf";
90 device = "nameofthesharedfolder";
91 options = [ "rw" ];
92 };
93}
94</programlisting>
95
96 <para>
97 The folder will be available directly under the root directory.
98 </para>
99</section>