2007-02-06 22:25:36 +01:00
|
|
|
|
<chapter xmlns="http://docbook.org/ns/docbook"
|
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
|
|
|
|
|
|
<title>Development</title>
|
|
|
|
|
|
|
|
|
|
<para>This chapter has some random notes on hacking on
|
|
|
|
|
NixOS.</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
|
|
|
|
|
<title>Building specific parts of NixOS</title>
|
|
|
|
|
|
|
|
|
|
<para>
|
|
|
|
|
|
|
|
|
|
<screen>
|
2008-02-08 23:43:59 +01:00
|
|
|
|
$ nix-build /etc/nixos/nixos <replaceable>attr</replaceable></screen>
|
2007-02-06 22:25:36 +01:00
|
|
|
|
|
|
|
|
|
where <replaceable>attr</replaceable> is an attribute in
|
2008-02-08 23:43:59 +01:00
|
|
|
|
<filename>/etc/nixos/nixos/default.nix</filename>. Attributes of interest include:
|
|
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
<term><varname>kernel</varname></term>
|
|
|
|
|
<listitem><para>The kernel.</para></listitem>
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
<term><varname>initialRamdisk</varname></term>
|
|
|
|
|
<listitem><para>The initial ramdisk (initrd) for this configuration.</para></listitem>
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
<term><varname>bootStage1</varname></term>
|
|
|
|
|
<listitem><para>The stage 1 (initrd) init script.</para></listitem>
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
<term><varname>bootStage2</varname></term>
|
|
|
|
|
<listitem><para>The stage 2 init script.</para></listitem>
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
<term><varname>etc</varname></term>
|
|
|
|
|
<listitem><para>The statically computed parts of <filename>/etc</filename>.</para></listitem>
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
|
<term><varname>upstartJobs</varname></term>
|
|
|
|
|
<listitem><para>An attribute set containing the Upstart jobs. For
|
|
|
|
|
instance, the <varname>sshd</varname> Upstart job can be built by
|
|
|
|
|
doing <literal>nix-build /etc/nixos/nixos -A
|
|
|
|
|
upstartJobs.sshd</literal>.</para></listitem>
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
|
|
</para>
|
2007-02-06 22:25:36 +01:00
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
|
|
|
|
|
<title>Testing the installer</title>
|
|
|
|
|
|
|
|
|
|
<para>Building, burning, and booting from an installation CD is rather
|
|
|
|
|
tedious, so here is a quick way to see if the installer works
|
|
|
|
|
properly:
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
$ nix-build .../nixos/configuration/rescue-cd.nix -A system.nixosInstall
|
|
|
|
|
$ dd if=/dev/zero of=diskimage seek=2G count=0 bs=1
|
|
|
|
|
$ yes | mke2fs -j diskimage
|
|
|
|
|
$ mount -o loop diskimage /mnt
|
|
|
|
|
$ ./result/bin/nixos-install</screen>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
2008-08-26 14:48:27 +02:00
|
|
|
|
<section>
|
|
|
|
|
|
|
|
|
|
<title>Testing the <literal>initrd</literal></title>
|
|
|
|
|
|
|
|
|
|
<para>A quick way to test whether the kernel and the initial ramdisk
|
|
|
|
|
boot correctly is to use QEMU’s <option>-kernel</option> and
|
|
|
|
|
<option>-initrd</option> options:
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
$ nix-build /etc/nixos/nixos -A initialRamdisk -o initrd
|
|
|
|
|
$ nix-build /etc/nixos/nixos -A kernel -o kernel
|
|
|
|
|
$ qemu-system-x86_64 -kernel ./kernel/vmlinuz -initrd ./initrd/initrd -hda /dev/null
|
|
|
|
|
</screen>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
2007-02-06 22:25:36 +01:00
|
|
|
|
</chapter>
|