nixpkgs/doc/manual/development.xml

85 lines
2.1 KiB
XML
Raw Normal View History

<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>
$ nix-build /etc/nixos/nixos <replaceable>attr</replaceable></screen>
where <replaceable>attr</replaceable> is an attribute in
<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>
</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>
</chapter>