2008-08-27 16:59:55 +04:00
|
|
|
|
<chapter xmlns="http://docbook.org/ns/docbook"
|
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
2012-06-25 19:24:05 +04:00
|
|
|
|
xml:id="chap-package-notes">
|
2008-08-27 16:59:55 +04:00
|
|
|
|
|
|
|
|
|
<title>Package Notes</title>
|
|
|
|
|
|
|
|
|
|
<para>This chapter contains information about how to use and maintain
|
|
|
|
|
the Nix expressions for a number of specific packages, such as the
|
|
|
|
|
Linux kernel or X.org.</para>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--============================================================-->
|
|
|
|
|
|
2010-01-13 15:11:06 +03:00
|
|
|
|
<section xml:id="sec-linux-kernel">
|
2008-08-27 16:59:55 +04:00
|
|
|
|
|
|
|
|
|
<title>Linux kernel</title>
|
|
|
|
|
|
|
|
|
|
<para>The Nix expressions to build the Linux kernel are in <link
|
2012-09-04 18:14:01 +04:00
|
|
|
|
xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel"><filename>pkgs/os-specific/linux/kernel</filename></link>.</para>
|
2008-08-27 16:59:55 +04:00
|
|
|
|
|
|
|
|
|
<para>The function that builds the kernel has an argument
|
|
|
|
|
<varname>kernelPatches</varname> which should be a list of
|
|
|
|
|
<literal>{name, patch, extraConfig}</literal> attribute sets, where
|
|
|
|
|
<varname>name</varname> is the name of the patch (which is included in
|
|
|
|
|
the kernel’s <varname>meta.description</varname> attribute),
|
|
|
|
|
<varname>patch</varname> is the patch itself (possibly compressed),
|
|
|
|
|
and <varname>extraConfig</varname> (optional) is a string specifying
|
|
|
|
|
extra options to be concatenated to the kernel configuration file
|
|
|
|
|
(<filename>.config</filename>).</para>
|
|
|
|
|
|
|
|
|
|
<para>The kernel derivation exports an attribute
|
|
|
|
|
<varname>features</varname> specifying whether optional functionality
|
|
|
|
|
is or isn’t enabled. This is used in NixOS to implement
|
|
|
|
|
kernel-specific behaviour. For instance, if the kernel has the
|
|
|
|
|
<varname>iwlwifi</varname> feature (i.e. has built-in support for
|
|
|
|
|
Intel wireless chipsets), then NixOS doesn’t have to build the
|
|
|
|
|
external <varname>iwlwifi</varname> package:
|
|
|
|
|
|
|
|
|
|
<programlisting>
|
|
|
|
|
modulesTree = [kernel]
|
|
|
|
|
++ pkgs.lib.optional (!kernel.features ? iwlwifi) kernelPackages.iwlwifi
|
|
|
|
|
++ ...;
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
<para>How to add a new (major) version of the Linux kernel to Nixpkgs:
|
|
|
|
|
|
|
|
|
|
<orderedlist>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
2012-09-04 18:14:01 +04:00
|
|
|
|
<para>Copy the old Nix expression
|
2008-08-27 16:59:55 +04:00
|
|
|
|
(e.g. <filename>linux-2.6.21.nix</filename>) to the new one
|
|
|
|
|
(e.g. <filename>linux-2.6.22.nix</filename>) and update it.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Add the new kernel to <filename>all-packages.nix</filename>
|
|
|
|
|
(e.g., create an attribute
|
|
|
|
|
<varname>kernel_2_6_22</varname>).</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Now we’re going to update the kernel configuration. First
|
|
|
|
|
unpack the kernel. Then for each supported platform
|
|
|
|
|
(<literal>i686</literal>, <literal>x86_64</literal>,
|
|
|
|
|
<literal>uml</literal>) do the following:
|
|
|
|
|
|
|
|
|
|
<orderedlist>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
2012-09-04 18:14:01 +04:00
|
|
|
|
<para>Make an copy from the old
|
2008-08-27 16:59:55 +04:00
|
|
|
|
config (e.g. <filename>config-2.6.21-i686-smp</filename>) to
|
|
|
|
|
the new one
|
|
|
|
|
(e.g. <filename>config-2.6.22-i686-smp</filename>).</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Copy the config file for this platform
|
|
|
|
|
(e.g. <filename>config-2.6.22-i686-smp</filename>) to
|
|
|
|
|
<filename>.config</filename> in the kernel source tree.
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Run <literal>make oldconfig
|
|
|
|
|
ARCH=<replaceable>{i386,x86_64,um}</replaceable></literal>
|
|
|
|
|
and answer all questions. (For the uml configuration, also
|
|
|
|
|
add <literal>SHELL=bash</literal>.) Make sure to keep the
|
|
|
|
|
configuration consistent between platforms (i.e. don’t
|
|
|
|
|
enable some feature on <literal>i686</literal> and disable
|
|
|
|
|
it on <literal>x86_64</literal>).
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>If needed you can also run <literal>make
|
|
|
|
|
menuconfig</literal>:
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
$ nix-env -i ncurses
|
|
|
|
|
$ export NIX_CFLAGS_LINK=-lncurses
|
|
|
|
|
$ make menuconfig ARCH=<replaceable>arch</replaceable></screen>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Copy <filename>.config</filename> over the new config
|
|
|
|
|
file (e.g. <filename>config-2.6.22-i686-smp</filename>).</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
</orderedlist>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>Test building the kernel: <literal>nix-build -A
|
|
|
|
|
kernel_2_6_22</literal>. If it compiles, ship it! For extra
|
|
|
|
|
credit, try booting NixOS with it.</para>
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
|
<para>It may be that the new kernel requires updating the external
|
|
|
|
|
kernel modules and kernel-dependent packages listed in the
|
|
|
|
|
<varname>kernelPackagesFor</varname> function in
|
|
|
|
|
<filename>all-packages.nix</filename> (such as the NVIDIA drivers,
|
2013-09-26 19:31:21 +04:00
|
|
|
|
AUFS, etc.). If the updated packages aren’t backwards compatible
|
|
|
|
|
with older kernels, you may need to keep the older versions
|
|
|
|
|
around.</para>
|
2008-08-27 16:59:55 +04:00
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
|
|
</orderedlist>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--============================================================-->
|
|
|
|
|
|
|
|
|
|
<section>
|
2009-04-20 20:00:40 +04:00
|
|
|
|
|
|
|
|
|
<title>X.org</title>
|
|
|
|
|
|
|
|
|
|
<para>The Nix expressions for the X.org packages reside in
|
|
|
|
|
<filename>pkgs/servers/x11/xorg/default.nix</filename>. This file is
|
2009-04-28 17:58:35 +04:00
|
|
|
|
automatically generated from lists of tarballs in an X.org release.
|
|
|
|
|
As such it should not be modified directly; rather, you should modify
|
|
|
|
|
the lists, the generator script or the file
|
|
|
|
|
<filename>pkgs/servers/x11/xorg/overrides.nix</filename>, in which you
|
|
|
|
|
can override or add to the derivations produced by the
|
|
|
|
|
generator.</para>
|
2009-04-20 20:00:40 +04:00
|
|
|
|
|
|
|
|
|
<para>The generator is invoked as follows:
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
$ cd pkgs/servers/x11/xorg
|
2010-01-06 01:48:22 +03:00
|
|
|
|
$ cat tarballs-7.5.list extra.list old.list \
|
2009-04-20 20:00:40 +04:00
|
|
|
|
| perl ./generate-expr-from-tarballs.pl
|
|
|
|
|
</screen>
|
|
|
|
|
|
|
|
|
|
For each of the tarballs in the <filename>.list</filename> files, the
|
|
|
|
|
script downloads it, unpacks it, and searches its
|
|
|
|
|
<filename>configure.ac</filename> and <filename>*.pc.in</filename>
|
|
|
|
|
files for dependencies. This information is used to generate
|
|
|
|
|
<filename>default.nix</filename>. The generator caches downloaded
|
|
|
|
|
tarballs between runs. Pay close attention to the <literal>NOT FOUND:
|
|
|
|
|
<replaceable>name</replaceable></literal> messages at the end of the
|
|
|
|
|
run, since they may indicate missing dependencies. (Some might be
|
|
|
|
|
optional dependencies, however.)</para>
|
|
|
|
|
|
2010-01-13 15:11:06 +03:00
|
|
|
|
<para>A file like <filename>tarballs-7.5.list</filename> contains all
|
2009-04-20 20:00:40 +04:00
|
|
|
|
tarballs in a X.org release. It can be generated like this:
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
$ export i="mirror://xorg/X11R7.4/src/everything/"
|
|
|
|
|
$ cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \
|
|
|
|
|
| perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'i'}$2\n"; }; }' \
|
|
|
|
|
| sort > tarballs-7.4.list
|
|
|
|
|
</screen>
|
|
|
|
|
|
|
|
|
|
<filename>extra.list</filename> contains libraries that aren’t part of
|
|
|
|
|
X.org proper, but are closely related to it, such as
|
|
|
|
|
<literal>libxcb</literal>. <filename>old.list</filename> contains
|
|
|
|
|
some packages that were removed from X.org, but are still needed by
|
|
|
|
|
some people or by other packages (such as
|
|
|
|
|
<varname>imake</varname>).</para>
|
|
|
|
|
|
|
|
|
|
<para>If the expression for a package requires derivation attributes
|
|
|
|
|
that the generator cannot figure out automatically (say,
|
|
|
|
|
<varname>patches</varname> or a <varname>postInstall</varname> hook),
|
2009-04-28 17:58:35 +04:00
|
|
|
|
you should modify
|
|
|
|
|
<filename>pkgs/servers/x11/xorg/overrides.nix</filename>.</para>
|
2009-04-20 20:00:40 +04:00
|
|
|
|
|
2008-08-27 16:59:55 +04:00
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
2009-04-20 20:00:40 +04:00
|
|
|
|
|
2008-08-27 16:59:55 +04:00
|
|
|
|
<!--============================================================-->
|
|
|
|
|
|
2012-05-12 01:42:00 +04:00
|
|
|
|
<!--
|
2008-08-27 16:59:55 +04:00
|
|
|
|
<section>
|
|
|
|
|
<title>Gnome</title>
|
|
|
|
|
<para>* Expression is auto-generated</para>
|
|
|
|
|
<para>* How to update</para>
|
|
|
|
|
</section>
|
2012-05-12 01:42:00 +04:00
|
|
|
|
-->
|
2008-08-27 16:59:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--============================================================-->
|
|
|
|
|
|
2012-05-12 01:42:00 +04:00
|
|
|
|
<!--
|
2008-08-27 16:59:55 +04:00
|
|
|
|
<section>
|
|
|
|
|
<title>GCC</title>
|
|
|
|
|
<para>…</para>
|
|
|
|
|
</section>
|
2012-05-12 01:42:00 +04:00
|
|
|
|
-->
|
2008-08-27 16:59:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</chapter>
|