<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.7">

<title>Release 1.7 (2014-04-11)</title>

<para>In addition to the usual bug fixes, this release has the
following new features:</para>

<itemizedlist>

  <listitem>
    <para>Antiquotation is now allowed inside of quoted attribute
    names (e.g. <literal>set."${foo}"</literal>). In the case where
    the attribute name is just a single antiquotation, the quotes can
    be dropped (e.g. the above example can be written
    <literal>set.${foo}</literal>). If an attribute name inside of a
    set declaration evaluates to <literal>null</literal> (e.g.
    <literal>{ ${null} = false; }</literal>), then that attribute is
    not added to the set.</para>
  </listitem>

  <listitem>
    <para>Experimental support for cryptographically signed binary
    caches.  See <link
    xlink:href="https://github.com/NixOS/nix/commit/0fdf4da0e979f992db75cc17376e455ddc5a96d8">the
    commit for details</link>.</para>
  </listitem>

  <listitem>
    <para>An experimental new substituter,
    <command>download-via-ssh</command>, that fetches binaries from
    remote machines via SSH.  Specifying the flags <literal>--option
    use-ssh-substituter true --option ssh-substituter-hosts
    <replaceable>user@hostname</replaceable></literal> will cause Nix
    to download binaries from the specified machine, if it has
    them.</para>
  </listitem>

  <listitem>
    <para><command>nix-store -r</command> and
    <command>nix-build</command> have a new flag,
    <option>--check</option>, that builds a previously built
    derivation again, and prints an error message if the output is not
    exactly the same. This helps to verify whether a derivation is
    truly deterministic.  For example:

<screen>
$ nix-build '&lt;nixpkgs>' -A patchelf
<replaceable>…</replaceable>
$ nix-build '&lt;nixpkgs>' -A patchelf --check
<replaceable>…</replaceable>
error: derivation `/nix/store/1ipvxs…-patchelf-0.6' may not be deterministic:
  hash mismatch in output `/nix/store/4pc1dm…-patchelf-0.6.drv'
</screen>

    </para>

  </listitem>

  <listitem>
    <para>The <command>nix-instantiate</command> flags
    <option>--eval-only</option> and <option>--parse-only</option>
    have been renamed to <option>--eval</option> and
    <option>--parse</option>, respectively.</para>
  </listitem>

  <listitem>
    <para><command>nix-instantiate</command>,
    <command>nix-build</command> and <command>nix-shell</command> now
    have a flag <option>--expr</option> (or <option>-E</option>) that
    allows you to specify the expression to be evaluated as a command
    line argument.  For instance, <literal>nix-instantiate --eval -E
    '1 + 2'</literal> will print <literal>3</literal>.</para>
  </listitem>

  <listitem>
    <para><command>nix-shell</command> improvements:</para>

    <itemizedlist>

      <listitem>
        <para>It has a new flag, <option>--packages</option> (or
        <option>-p</option>), that sets up a build environment
        containing the specified packages from Nixpkgs. For example,
        the command

<screen>
$ nix-shell -p sqlite xorg.libX11 hello
</screen>

        will start a shell in which the given packages are
        present.</para>
      </listitem>

      <listitem>
        <para>It now uses <filename>shell.nix</filename> as the
        default expression, falling back to
        <filename>default.nix</filename> if the former doesn’t
        exist.  This makes it convenient to have a
        <filename>shell.nix</filename> in your project to set up a
        nice development environment.</para>
      </listitem>

      <listitem>
        <para>It evaluates the derivation attribute
        <varname>shellHook</varname>, if set. Since
        <literal>stdenv</literal> does not normally execute this hook,
        it allows you to do <command>nix-shell</command>-specific
        setup.</para>
      </listitem>

      <listitem>
        <para>It preserves the user’s timezone setting.</para>
      </listitem>

    </itemizedlist>

  </listitem>

  <listitem>
    <para>In chroots, Nix now sets up a <filename>/dev</filename>
    containing only a minimal set of devices (such as
    <filename>/dev/null</filename>). Note that it only does this if
    you <emphasis>don’t</emphasis> have <filename>/dev</filename>
    listed in your <option>build-chroot-dirs</option> setting;
    otherwise, it will bind-mount the <literal>/dev</literal> from
    outside the chroot.</para>

    <para>Similarly, if you don’t have <filename>/dev/pts</filename> listed
    in <option>build-chroot-dirs</option>, Nix will mount a private
    <literal>devpts</literal> filesystem on the chroot’s
    <filename>/dev/pts</filename>.</para>

  </listitem>

  <listitem>
    <para>New built-in function: <function>builtins.toJSON</function>,
    which returns a JSON representation of a value.</para>
  </listitem>

  <listitem>
    <para><command>nix-env -q</command> has a new flag
    <option>--json</option> to print a JSON representation of the
    installed or available packages.</para>
  </listitem>

  <listitem>
    <para><command>nix-env</command> now supports meta attributes with
    more complex values, such as attribute sets.</para>
  </listitem>

  <listitem>
    <para>The <option>-A</option> flag now allows attribute names with
    dots in them, e.g.

<screen>
$ nix-instantiate --eval '&lt;nixos>' -A 'config.systemd.units."nscd.service".text'
</screen>

    </para>
  </listitem>

  <listitem>
    <para>The <option>--max-freed</option> option to
    <command>nix-store --gc</command> now accepts a unit
    specifier. For example, <literal>nix-store --gc --max-freed
    1G</literal> will free up to 1 gigabyte of disk space.</para>
  </listitem>

  <listitem>
    <para><command>nix-collect-garbage</command> has a new flag
    <option>--delete-older-than</option>
    <replaceable>N</replaceable><literal>d</literal>, which deletes
    all user environment generations older than
    <replaceable>N</replaceable> days.  Likewise, <command>nix-env
    --delete-generations</command> accepts a
    <replaceable>N</replaceable><literal>d</literal> age limit.</para>
  </listitem>

  <listitem>
    <para>Nix now heuristically detects whether a build failure was
    due to a disk-full condition. In that case, the build is not
    flagged as “permanently failed”. This is mostly useful for Hydra,
    which needs to distinguish between permanent and transient build
    failures.</para>
  </listitem>

  <listitem>
    <para>There is a new symbol <literal>__curPos</literal> that
    expands to an attribute set containing its file name and line and
    column numbers, e.g. <literal>{ file = "foo.nix"; line = 10;
    column = 5; }</literal>.  There also is a new builtin function,
    <varname>unsafeGetAttrPos</varname>, that returns the position of
    an attribute.  This is used by Nixpkgs to provide location
    information in error messages, e.g.

<screen>
$ nix-build '&lt;nixpkgs>' -A libreoffice --argstr system x86_64-darwin
error: the package ‘libreoffice-4.0.5.2’ in ‘.../applications/office/libreoffice/default.nix:263’
  is not supported on ‘x86_64-darwin’
</screen>

    </para>
  </listitem>

  <listitem>
    <para>The garbage collector is now more concurrent with other Nix
    processes because it releases certain locks earlier.</para>
  </listitem>

  <listitem>
    <para>The binary tarball installer has been improved.  You can now
    install Nix by running:

<screen>
$ bash &lt;(curl https://nixos.org/nix/install)
</screen>

    </para>
  </listitem>

  <listitem>
    <para>More evaluation errors include position information. For
    instance, selecting a missing attribute will print something like

<screen>
error: attribute `nixUnstabl' missing, at /etc/nixos/configurations/misc/eelco/mandark.nix:216:15
</screen>

    </para>
  </listitem>

  <listitem>
    <para>The command <command>nix-setuid-helper</command> is
    gone.</para>
  </listitem>

  <listitem>
    <para>Nix no longer uses Automake, but instead has a
    non-recursive, GNU Make-based build system.</para>
  </listitem>

  <listitem>
    <para>All installed libraries now have the prefix
    <literal>libnix</literal>.  In particular, this gets rid of
    <literal>libutil</literal>, which could clash with libraries with
    the same name from other packages.</para>
  </listitem>

  <listitem>
    <para>Nix now requires a compiler that supports C++11.</para>
  </listitem>

</itemizedlist>

<para>This release has contributions from Danny Wilson, Domen Kožar,
Eelco Dolstra, Ian-Woo Kim, Ludovic Courtès, Maxim Ivanov, Petr
Rockai, Ricardo M. Correia and Shea Levy.</para>

</section>