<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="ssec-relnotes-1.2">

<title>Release 1.2 (2012-12-06)</title>

<para>This release has the following improvements and changes:</para>

<itemizedlist>

  <listitem>
    <para>Nix has a new binary substituter mechanism: the
    <emphasis>binary cache</emphasis>.  A binary cache contains
    pre-built binaries of Nix packages.  Whenever Nix wants to build a
    missing Nix store path, it will check a set of binary caches to
    see if any of them has a pre-built binary of that path.  The
    configuration setting <option>binary-caches</option> contains a
    list of URLs of binary caches.  For instance, doing
<screen>
$ nix-env -i thunderbird --option binary-caches http://cache.nixos.org
</screen>
    will install Thunderbird and its dependencies, using the available
    pre-built binaries in <uri>http://cache.nixos.org</uri>.
    The main advantage over the old “manifest”-based method of getting
    pre-built binaries is that you don’t have to worry about your
    manifest being in sync with the Nix expressions you’re installing
    from; i.e., you don’t need to run <command>nix-pull</command> to
    update your manifest.  It’s also more scalable because you don’t
    need to redownload a giant manifest file every time.
    </para>

    <para>A Nix channel can provide a binary cache URL that will be
    used automatically if you subscribe to that channel.  If you use
    the Nixpkgs or NixOS channels
    (<uri>http://nixos.org/channels</uri>) you automatically get the
    cache <uri>http://cache.nixos.org</uri>.</para>

    <para>Binary caches are created using <command>nix-push</command>.
    For details on the operation and format of binary caches, see the
    <command>nix-push</command> manpage.  More details are provided in
    <link xlink:href="http://lists.science.uu.nl/pipermail/nix-dev/2012-September/009826.html">this
    nix-dev posting</link>.</para>
  </listitem>

  <listitem>
    <para>Multiple output support should now be usable.  A derivation
    can declare that it wants to produce multiple store paths by
    saying something like
<programlisting>
outputs = [ "lib" "headers" "doc" ];
</programlisting>
    This will cause Nix to pass the intended store path of each output
    to the builder through the environment variables
    <literal>lib</literal>, <literal>headers</literal> and
    <literal>doc</literal>.  Other packages can refer to a specific
    output by referring to
    <literal><replaceable>pkg</replaceable>.<replaceable>output</replaceable></literal>,
    e.g.
<programlisting>
buildInputs = [ pkg.lib pkg.headers ];
</programlisting>
    If you install a package with multiple outputs using
    <command>nix-env</command>, each output path will be symlinked
    into the user environment.</para>
  </listitem>

  <listitem>
    <para>Dashes are now valid as part of identifiers and attribute
    names.</para>
  </listitem>

  <listitem>
    <para>The new operation <command>nix-store --repair-path</command>
    allows corrupted or missing store paths to be repaired by
    redownloading them.  <command>nix-store --verify --check-contents
    --repair</command> will scan and repair all paths in the Nix
    store.  Similarly, <command>nix-env</command>,
    <command>nix-build</command>, <command>nix-instantiate</command>
    and <command>nix-store --realise</command> have a
    <option>--repair</option> flag to detect and fix bad paths by
    rebuilding or redownloading them.</para>
  </listitem>

  <listitem>
    <para>Nix no longer sets the immutable bit on files in the Nix
    store.  Instead, the recommended way to guard the Nix store
    against accidental modification on Linux is to make it a read-only
    bind mount, like this:

<screen>
$ mount --bind /nix/store /nix/store
$ mount -o remount,ro,bind /nix/store
</screen>

    Nix will automatically make <filename>/nix/store</filename>
    writable as needed (using a private mount namespace) to allow
    modifications.</para>
  </listitem>

  <listitem>
    <para>Store optimisation (replacing identical files in the store
    with hard links) can now be done automatically every time a path
    is added to the store.  This is enabled by setting the
    configuration option <literal>auto-optimise-store</literal> to
    <literal>true</literal> (disabled by default).</para>
  </listitem>

  <listitem>
    <para>Nix now supports <command>xz</command> compression for NARs
    in addition to <command>bzip2</command>.  It compresses about 30%
    better on typical archives and decompresses about twice as
    fast.</para>
  </listitem>

  <listitem>
    <para>Basic Nix expression evaluation profiling: setting the
    environment variable <envar>NIX_COUNT_CALLS</envar> to
    <literal>1</literal> will cause Nix to print how many times each
    primop or function was executed.</para>
  </listitem>

  <listitem>
    <para>New primops: <varname>concatLists</varname>,
    <varname>elem</varname>, <varname>elemAt</varname> and
    <varname>filter</varname>.</para>
  </listitem>

  <listitem>
    <para>The command <command>nix-copy-closure</command> has a new
    flag <option>--use-substitutes</option> (<option>-s</option>) to
    download missing paths on the target machine using the substitute
    mechanism.</para>
  </listitem>

  <listitem>
    <para>The command <command>nix-worker</command> has been renamed
    to <command>nix-daemon</command>.  Support for running the Nix
    worker in “slave” mode has been removed.</para>
  </listitem>

  <listitem>
    <para>The <option>--help</option> flag of every Nix command now
    invokes <command>man</command>.</para>
  </listitem>

  <listitem>
    <para>Chroot builds are now supported on systemd machines.</para>
  </listitem>

</itemizedlist>

<para>This release has contributions from Eelco Dolstra, Florian
Friesdorf, Mats Erik Andersson and Shea Levy.</para>

</section>