<section xmlns="http://docbook.org/ns/docbook"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      version="5.0"
      xml:id="ch-relnotes-0.10">

<title>Release 0.10 (2006-10-06)</title>

<note><para>This version of Nix uses Berkeley DB 4.4 instead of 4.3.
The database is upgraded automatically, but you should be careful not
to use old versions of Nix that still use Berkeley DB 4.3.  In
particular, if you use a Nix installed through Nix, you should run

<screen>
$ nix-store --clear-substitutes</screen>

first.</para></note>

<warning><para>Also, the database schema has changed slighted to fix a
performance issue (see below).  When you run any Nix 0.10 command for
the first time, the database will be upgraded automatically.  This is
irreversible.</para></warning>

<itemizedlist>


  <!-- Usability / features -->


  <listitem><para><command>nix-env</command> usability improvements:

    <itemizedlist>

      <listitem><para>An option <option>--compare-versions</option>
      (or <option>-c</option>) has been added to <command>nix-env
      --query</command> to allow you to compare installed versions of
      packages to available versions, or vice versa.  An easy way to
      see if you are up to date with what’s in your subscribed
      channels is <literal>nix-env -qc \*</literal>.</para></listitem>

      <listitem><para><literal>nix-env --query</literal> now takes as
      arguments a list of package names about which to show
      information, just like <option>--install</option>, etc.: for
      example, <literal>nix-env -q gcc</literal>.  Note that to show
      all derivations, you need to specify
      <literal>\*</literal>.</para></listitem>

      <listitem><para><literal>nix-env -i
      <replaceable>pkgname</replaceable></literal> will now install
      the highest available version of
      <replaceable>pkgname</replaceable>, rather than installing all
      available versions (which would probably give collisions)
      (<literal>NIX-31</literal>).</para></listitem>

      <listitem><para><literal>nix-env (-i|-u) --dry-run</literal> now
      shows exactly which missing paths will be built or
      substituted.</para></listitem>

      <listitem><para><literal>nix-env -qa --description</literal>
      shows human-readable descriptions of packages, provided that
      they have a <literal>meta.description</literal> attribute (which
      most packages in Nixpkgs don’t have yet).</para></listitem>

    </itemizedlist>

  </para></listitem>


  <listitem><para>New language features:

    <itemizedlist>

      <listitem><para>Reference scanning (which happens after each
      build) is much faster and takes a constant amount of
      memory.</para></listitem>

      <listitem><para>String interpolation.  Expressions like

<programlisting>
"--with-freetype2-library=" + freetype + "/lib"</programlisting>

      can now be written as

<programlisting>
"--with-freetype2-library=${freetype}/lib"</programlisting>

      You can write arbitrary expressions within
      <literal>${<replaceable>...</replaceable>}</literal>, not just
      identifiers.</para></listitem>

      <listitem><para>Multi-line string literals.</para></listitem>

      <listitem><para>String concatenations can now involve
      derivations, as in the example <code>"--with-freetype2-library="
      + freetype + "/lib"</code>.  This was not previously possible
      because we need to register that a derivation that uses such a
      string is dependent on <literal>freetype</literal>.  The
      evaluator now properly propagates this information.
      Consequently, the subpath operator (<literal>~</literal>) has
      been deprecated.</para></listitem>

      <listitem><para>Default values of function arguments can now
      refer to other function arguments; that is, all arguments are in
      scope in the default values
      (<literal>NIX-45</literal>).</para></listitem>

      <!--
      <listitem><para>TODO: domain checks (r5895).</para></listitem>
      -->

      <listitem><para>Lots of new built-in primitives, such as
      functions for list manipulation and integer arithmetic.  See the
      manual for a complete list.  All primops are now available in
      the set <varname>builtins</varname>, allowing one to test for
      the availability of primop in a backwards-compatible
      way.</para></listitem>

      <listitem><para>Real let-expressions: <literal>let x = ...;
      ... z = ...; in ...</literal>.</para></listitem>

    </itemizedlist>

  </para></listitem>


  <listitem><para>New commands <command>nix-pack-closure</command> and
  <command>nix-unpack-closure</command> than can be used to easily
  transfer a store path with all its dependencies to another machine.
  Very convenient whenever you have some package on your machine and
  you want to copy it somewhere else.</para></listitem>


  <listitem><para>XML support:

    <itemizedlist>

      <listitem><para><literal>nix-env -q --xml</literal> prints the
      installed or available packages in an XML representation for
      easy processing by other tools.</para></listitem>

      <listitem><para><literal>nix-instantiate --eval-only
      --xml</literal> prints an XML representation of the resulting
      term.  (The new flag <option>--strict</option> forces ‘deep’
      evaluation of the result, i.e., list elements and attributes are
      evaluated recursively.)</para></listitem>

      <listitem><para>In Nix expressions, the primop
      <function>builtins.toXML</function> converts a term to an XML
      representation.  This is primarily useful for passing structured
      information to builders.</para></listitem>

    </itemizedlist>

  </para></listitem>


  <listitem><para>You can now unambiguously specify which derivation to
  build or install in <command>nix-env</command>,
  <command>nix-instantiate</command> and <command>nix-build</command>
  using the <option>--attr</option> / <option>-A</option> flags, which
  takes an attribute name as argument.  (Unlike symbolic package names
  such as <literal>subversion-1.4.0</literal>, attribute names in an
  attribute set are unique.)  For instance, a quick way to perform a
  test build of a package in Nixpkgs is <literal>nix-build
  pkgs/top-level/all-packages.nix -A
  <replaceable>foo</replaceable></literal>.  <literal>nix-env -q
  --attr</literal> shows the attribute names corresponding to each
  derivation.</para></listitem>


  <listitem><para>If the top-level Nix expression used by
  <command>nix-env</command>, <command>nix-instantiate</command> or
  <command>nix-build</command> evaluates to a function whose arguments
  all have default values, the function will be called automatically.
  Also, the new command-line switch <option>--arg
  <replaceable>name</replaceable>
  <replaceable>value</replaceable></option> can be used to specify
  function arguments on the command line.</para></listitem>


  <listitem><para><literal>nix-install-package --url
  <replaceable>URL</replaceable></literal> allows a package to be
  installed directly from the given URL.</para></listitem>


  <listitem><para>Nix now works behind an HTTP proxy server; just set
  the standard environment variables <envar>http_proxy</envar>,
  <envar>https_proxy</envar>, <envar>ftp_proxy</envar> or
  <envar>all_proxy</envar> appropriately.  Functions such as
  <function>fetchurl</function> in Nixpkgs also respect these
  variables.</para></listitem>


  <listitem><para><literal>nix-build -o
  <replaceable>symlink</replaceable></literal> allows the symlink to
  the build result to be named something other than
  <literal>result</literal>.</para></listitem>


  <!-- Stability / performance / etc. -->


  <listitem><para>Platform support:

    <itemizedlist>

      <listitem><para>Support for 64-bit platforms, provided a <link
      xlink:href="http://bugzilla.sen.cwi.nl:8080/show_bug.cgi?id=606">suitably
      patched ATerm library</link> is used.  Also, files larger than 2
      GiB are now supported.</para></listitem>

      <listitem><para>Added support for Cygwin (Windows,
      <literal>i686-cygwin</literal>), Mac OS X on Intel
      (<literal>i686-darwin</literal>) and Linux on PowerPC
      (<literal>powerpc-linux</literal>).</para></listitem>

      <listitem><para>Users of SMP and multicore machines will
      appreciate that the number of builds to be performed in parallel
      can now be specified in the configuration file in the
      <literal>build-max-jobs</literal> setting.</para></listitem>

    </itemizedlist>

  </para></listitem>


  <listitem><para>Garbage collector improvements:

    <itemizedlist>

      <listitem><para>Open files (such as running programs) are now
      used as roots of the garbage collector.  This prevents programs
      that have been uninstalled from being garbage collected while
      they are still running.  The script that detects these
      additional runtime roots
      (<filename>find-runtime-roots.pl</filename>) is inherently
      system-specific, but it should work on Linux and on all
      platforms that have the <command>lsof</command>
      utility.</para></listitem>

      <listitem><para><literal>nix-store --gc</literal>
      (a.k.a. <command>nix-collect-garbage</command>) prints out the
      number of bytes freed on standard output.  <literal>nix-store
      --gc --print-dead</literal> shows how many bytes would be freed
      by an actual garbage collection.</para></listitem>

      <listitem><para><literal>nix-collect-garbage -d</literal>
      removes all old generations of <emphasis>all</emphasis> profiles
      before calling the actual garbage collector (<literal>nix-store
      --gc</literal>).  This is an easy way to get rid of all old
      packages in the Nix store.</para></listitem>

      <listitem><para><command>nix-store</command> now has an
      operation <option>--delete</option> to delete specific paths
      from the Nix store.  It won’t delete reachable (non-garbage)
      paths unless <option>--ignore-liveness</option> is
      specified.</para></listitem>

    </itemizedlist>

  </para></listitem>


  <listitem><para>Berkeley DB 4.4’s process registry feature is used
  to recover from crashed Nix processes.</para></listitem>

  <!--  <listitem><para>TODO: shared stores.</para></listitem> -->

  <listitem><para>A performance issue has been fixed with the
  <literal>referer</literal> table, which stores the inverse of the
  <literal>references</literal> table (i.e., it tells you what store
  paths refer to a given path).  Maintaining this table could take a
  quadratic amount of time, as well as a quadratic amount of Berkeley
  DB log file space (in particular when running the garbage collector)
  (<literal>NIX-23</literal>).</para></listitem>

  <listitem><para>Nix now catches the <literal>TERM</literal> and
  <literal>HUP</literal> signals in addition to the
  <literal>INT</literal> signal.  So you can now do a <literal>killall
  nix-store</literal> without triggering a database
  recovery.</para></listitem>

  <listitem><para><command>bsdiff</command> updated to version
  4.3.</para></listitem>

  <listitem><para>Substantial performance improvements in expression
  evaluation and <literal>nix-env -qa</literal>, all thanks to <link
  xlink:href="http://valgrind.org/">Valgrind</link>.  Memory use has
  been reduced by a factor 8 or so.  Big speedup by memoisation of
  path hashing.</para></listitem>

  <listitem><para>Lots of bug fixes, notably:

    <itemizedlist>

      <listitem><para>Make sure that the garbage collector can run
      successfully when the disk is full
      (<literal>NIX-18</literal>).</para></listitem>

      <listitem><para><command>nix-env</command> now locks the profile
      to prevent races between concurrent <command>nix-env</command>
      operations on the same profile
      (<literal>NIX-7</literal>).</para></listitem>

      <listitem><para>Removed misleading messages from
      <literal>nix-env -i</literal> (e.g., <literal>installing
      `foo'</literal> followed by <literal>uninstalling
      `foo'</literal>) (<literal>NIX-17</literal>).</para></listitem>

    </itemizedlist>

  </para></listitem>

  <listitem><para>Nix source distributions are a lot smaller now since
  we no longer include a full copy of the Berkeley DB source
  distribution (but only the bits we need).</para></listitem>

  <listitem><para>Header files are now installed so that external
  programs can use the Nix libraries.</para></listitem>

</itemizedlist>

</section>
