Compare commits

...

31 Commits
flake ... 2.1

Author SHA1 Message Date
Eelco Dolstra
b4441c9690 Release notes tweaks
(cherry picked from commit 4dd09210d7)
2018-09-02 21:47:53 +02:00
Graham Christensen
eb40c23dfd Create upgrade notes
(cherry picked from commit c42eaaf684)
2018-09-01 23:30:16 +02:00
Graham Christensen
7fe614b5c9 release notes: note that the multi-user installer is available but not selected for Linux with systemd, and the bug about selinux
(cherry picked from commit 4be7652dd3)
2018-09-01 23:30:16 +02:00
Graham Christensen
95ed61c990 Default to single-user install
(cherry picked from commit 51f9682a8b)
2018-09-01 23:30:16 +02:00
Graham Christensen
93cae69725 Document the multi-user installer some
Use sh <(...) syntax for installation to preserve stdin and prompting

also update installation docs to account for changes in multi-user selection

(cherry picked from commit c3e508d924)
2018-09-01 23:30:16 +02:00
Graham Christensen
a4a72c0152 We support aarch64 now
(cherry picked from commit f66fa7cd20)
2018-09-01 23:30:15 +02:00
Graham Christensen
348a2eb84a nix-build: Print stats even in failing builds
(cherry picked from commit 87702532d2)
2018-09-01 23:30:15 +02:00
Graham Christensen
958e037a08 nix-build: print stats on sucessful builds
(cherry picked from commit b7bb627f67)
2018-09-01 23:30:15 +02:00
Graham Christensen
75a041c36c Drop ssh://... as a required formatting for builtins.fetchGit
(cherry picked from commit 0b7568fb73)
2018-09-01 23:29:51 +02:00
Eelco Dolstra
6202ffdce9 fetchGit/fetchMercurial: Don't absolutize paths
This is already done by coerceToString(), provided that the argument
is a path (e.g. 'fetchGit ./bla'). It fixes the handling of URLs like
git@github.com:owner/repo.git. It breaks 'fetchGit "./bla"', but that
was never intended to work anyway and is inconsistent with other
builtin functions (e.g. 'readFile "./bla"' fails).

(cherry picked from commit 475a0a54a9)
2018-09-01 23:29:51 +02:00
Eelco Dolstra
d2339af44c nix path-info: Remove trailing spaces
Fixes #2390.

(cherry picked from commit b7409c5754)
2018-09-01 23:29:37 +02:00
Eelco Dolstra
b71789885a Add contributors
(cherry picked from commit 4095cd6438)
2018-09-01 23:29:37 +02:00
Graham Christensen
165743b8bf docs: Add IDs to important sections
(cherry picked from commit 149d10c308)
2018-09-01 23:29:37 +02:00
Graham Christensen
81028d5b87 docs: Add some examples to fetchGit
(cherry picked from commit 2df21b78b9)
2018-09-01 23:29:37 +02:00
Graham Christensen
d3088a64db manual: document why ~/.netrc doesn't work
Maybe there is a better place to document this, which is more generic?

(cherry picked from commit 33712fed38)
2018-09-01 23:29:01 +02:00
Niklas Hambüchen
d853b57991 manual: distributed-builds: Mention - as default
(cherry picked from commit 10ebcf8670)
2018-09-01 23:29:01 +02:00
Symphorien Gibol
1d619967ef add manual entries for disallowedRequisites and disallowedReferences
(cherry picked from commit 81d1385437)
2018-09-01 23:29:01 +02:00
Erik Arvstedt
8115c10e59 Docs: Fix install prefix
shell.nix defines the install prefix as $(pwd)/inst

(cherry picked from commit 8ad2defdf0)
2018-08-31 16:12:27 +02:00
Eelco Dolstra
b7a37ab5f2 nix upgrade-nix: Handle .nix-profile being a link to .../profiles/per-user/...
Also some cosmetic improvements.

(cherry picked from commit 39f1722f36)
2018-08-31 16:12:11 +02:00
Eelco Dolstra
f8fbab43f2 nix upgrade-nix: Improve error message if 'nix' is not in a profile
E.g.

  $ nix upgrade-nix
  error: directory '/home/eelco/Dev/nix/inst/bin' does not appear to be part of a Nix profile

instead of

  $ nix upgrade-nix
  error: '/home/eelco/Dev/nix/inst' is not a symlink

(cherry picked from commit f08b14c9d0)
2018-08-31 16:12:11 +02:00
Eelco Dolstra
d7b2c6c92f Add simple test for nix upgrade-nix
(cherry picked from commit 264e66f696)
2018-08-31 16:12:11 +02:00
Michael Bishop
8b0761b172 fix error: unknown serve command 9
(cherry picked from commit 0767e402f1)
2018-08-31 16:12:11 +02:00
Daiderd Jordan
2b25ffbd49 upgrade-nix: resolve profile symlinks
The profile present in PATH is not necessarily the actual profile
location. User profiles are generally added as $HOME/.nix-profile
in which case the indirect profile link needs to be resolved first.

/home/user/.nix-profile -> /nix/var/nix/profiles/per-user/user/profile
/nix/var/nix/profiles/per-user/user/profile -> profile-15-link
/nix/var/nix/profiles/per-user/user/profile-14-link -> /nix/store/hyi4kkjh3bwi2z3wfljrkfymz9904h62-user-environment
/nix/var/nix/profiles/per-user/user/profile-15-link -> /nix/store/6njpl3qvihz46vj911pwx7hfcvwhifl9-user-environment

To upgrade nix here we want /nix/var/nix/profiles/per-user/user/profile-16-link
instead of /home/user/.nix-profile-1-link. The latter is not a gcroot
and would be garbage collected, resulting in a broken profile.

Fixes #2175

(cherry picked from commit d85bb4814f)
2018-08-31 16:12:11 +02:00
Daiderd Jordan
88d2e298f5 upgrade-nix: add --dry-run
(cherry picked from commit 414397759a)
2018-08-31 16:12:11 +02:00
Eelco Dolstra
1fceed528d nix: Remove the -h flag
(cherry picked from commit 5e83b0227f)
2018-08-31 16:11:09 +02:00
Eelco Dolstra
b542267d18 Remove boost from the closure
This reduces the size of the closure by 45 MiB.

(cherry picked from commit 145db703e5)
2018-08-31 16:11:09 +02:00
Eelco Dolstra
e76eec86bd Update release notes
(cherry picked from commit 64d7d1a884)
2018-08-31 16:11:06 +02:00
Eelco Dolstra
25af916eb4 Revert "Fix parser/lexer generation with parallel make"
This reverts commit d277442df5.

Make sucks.

(cherry picked from commit c651b7bdc9)
2018-08-30 12:48:48 +02:00
Tuomas Tynkkynen
0107a8f6d4 Drop all references to NIX_INDENT_MAKE
Dead code since 6669a3b477

(cherry picked from commit 2894197de7)
2018-08-30 12:48:32 +02:00
Tuomas Tynkkynen
c2dcc102e4 Drop all references to --disable-init-state
It's all dead code since 2014 (commit 0c6d62cf27).

(cherry picked from commit 458282be59)
2018-08-30 12:48:32 +02:00
Ivan Kozik
9280d11e54 repl: don't add trailing spaces to history lines
(cherry picked from commit ec49ea28dc)
2018-08-30 12:48:28 +02:00
27 changed files with 465 additions and 105 deletions

View File

@@ -229,12 +229,6 @@ if test "$gc" = yes; then
fi
AC_ARG_ENABLE(init-state, AC_HELP_STRING([--disable-init-state],
[do not initialise DB etc. in `make install']),
init_state=$enableval, init_state=yes)
#AM_CONDITIONAL(INIT_STATE, test "$init_state" = "yes")
# documentation generation switch
AC_ARG_ENABLE(doc-gen, AC_HELP_STRING([--disable-doc-gen],
[disable documentation generation]),

View File

@@ -1,6 +1,7 @@
<part xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xml:id="part-advanced-topics"
version="5.0">
<title>Advanced Topics</title>

View File

@@ -81,6 +81,7 @@ or a newline, e.g.
<para>Each machine specification consists of the following elements,
separated by spaces. Only the first element is required.
To leave a field at its default, set it to <literal>-</literal>.
<orderedlist>

View File

@@ -524,7 +524,12 @@ password <replaceable>my-password</replaceable>
For the exact syntax, see <link
xlink:href="https://ec.haxx.se/usingcurl-netrc.html">the
<literal>curl</literal> documentation.</link></para></listitem>
<literal>curl</literal> documentation.</link></para>
<note><para>This must be an absolute path, and <literal>~</literal>
is not resolved. For example, <filename>~/.netrc</filename> won't
resolve to your home directory's <filename>.netrc</filename>.</para></note>
</listitem>
</varlistentry>

View File

@@ -50,6 +50,40 @@ allowedRequisites = [ foobar ];
</varlistentry>
<varlistentry><term><varname>disallowedReferences</varname></term>
<listitem><para>The optional attribute
<varname>disallowedReferences</varname> specifies a list of illegal
references (dependencies) of the output of the builder. For
example,
<programlisting>
disallowedReferences = [ foo ];
</programlisting>
enforces that the output of a derivation cannot have a direct runtime
dependencies on the derivation <varname>foo</varname>.</para></listitem>
</varlistentry>
<varlistentry><term><varname>disallowedRequisites</varname></term>
<listitem><para>This attribute is similar to
<varname>disallowedReferences</varname>, but it specifies illegal
requisites for the whole closure, so all the dependencies
recursively. For example,
<programlisting>
disallowedRequisites = [ foobar ];
</programlisting>
enforces that the output of a derivation cannot have any
runtime dependency on <varname>foobar</varname> or any other derivation
depending recursively on <varname>foobar</varname>.</para></listitem>
</varlistentry>
<varlistentry><term><varname>exportReferencesGraph</varname></term>

View File

@@ -398,6 +398,84 @@ stdenv.mkDerivation { … }
</listitem>
</varlistentry>
</variablelist>
<example>
<title>Fetching a private repository over SSH</title>
<programlisting>builtins.fetchGit {
url = "git@github.com:my-secret/repository.git";
ref = "master";
rev = "adab8b916a45068c044658c4158d81878f9ed1c3";
}</programlisting>
</example>
<example>
<title>Fetching a repository's specific commit on an arbitrary branch</title>
<para>
If the revision you're looking for is in the default branch
of the gift repository you don't strictly need to specify
the branch name in the <varname>ref</varname> attribute.
</para>
<para>
However, if the revision you're looking for is in a future
branch for the non-default branch you will need to specify
the the <varname>ref</varname> attribute as well.
</para>
<programlisting>builtins.fetchGit {
url = "https://github.com/nixos/nix.git";
rev = "841fcbd04755c7a2865c51c1e2d3b045976b7452";
ref = "1.11-maintenance";
}</programlisting>
<note>
<para>
It is nice to always specify the branch which a revision
belongs to. Without the branch being specified, the
fetcher might fail if the default branch changes.
Additionally, it can be confusing to try a commit from a
non-default branch and see the fetch fail. If the branch
is specified the fault is much more obvious.
</para>
</note>
</example>
<example>
<title>Fetching a repository's specific commit on the default branch</title>
<para>
If the revision you're looking for is in the default branch
of the gift repository you may omit the
<varname>ref</varname> attribute.
</para>
<programlisting>builtins.fetchGit {
url = "https://github.com/nixos/nix.git";
rev = "841fcbd04755c7a2865c51c1e2d3b045976b7452";
}</programlisting>
</example>
<example>
<title>Fetching a tag</title>
<programlisting>builtins.fetchGit {
url = "https://github.com/nixos/nix.git";
ref = "tags/1.9";
}</programlisting>
<note><para>Due to a bug (<link
xlink:href="https://github.com/NixOS/nix/issues/2385">#2385</link>),
only non-annotated tags can be fetched.</para></note>
</example>
<example>
<title>Fetching the latest version of a remote branch</title>
<para>
<function>builtins.fetchGit</function> can behave impurely
fetch the latest version of a remote branch.
</para>
<note><para>Nix will refetch the branch in accordance to
<option>tarball-ttl</option>.</para></note>
<note><para>This behavior is disabled in
<emphasis>Pure evaluation mode</emphasis>.</para></note>
<programlisting>builtins.fetchGit {
url = "ssh://git@github.com/nixos/nix.git";
ref = "master";
}</programlisting>
</example>
</listitem>
</varlistentry>
@@ -1244,8 +1322,8 @@ in foo</programlisting>
This is not allowed because it would cause a cyclic dependency in
the computation of the cryptographic hashes for
<varname>foo</varname> and <varname>bar</varname>.</para>
<para>It is also not possible to reference the result of a derivation.
If you are using Nixpkgs, the <literal>writeTextFile</literal> function is able to
<para>It is also not possible to reference the result of a derivation.
If you are using Nixpkgs, the <literal>writeTextFile</literal> function is able to
do that.</para></listitem>
</varlistentry>

View File

@@ -41,7 +41,7 @@ encountered</quote>).</para></footnote>.</para>
</simplesect>
<simplesect><title>Let-expressions</title>
<simplesect xml:id="sect-let-expressions"><title>Let-expressions</title>
<para>A let-expression allows you define local variables for an
expression. For instance,

View File

@@ -1,5 +1,6 @@
<appendix xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="part-glossary">
<title>Glossary</title>

View File

@@ -30,7 +30,7 @@ To build Nix itself in this shell:
[nix-shell]$ configurePhase
[nix-shell]$ make
</screen>
To install it in <literal>$(pwd)/nix</literal> and test it:
To install it in <literal>$(pwd)/inst</literal> and test it:
<screen>
[nix-shell]$ make install
[nix-shell]$ make installcheck

View File

@@ -39,7 +39,7 @@ bundle.</para>
<step><para>Set the environment variable and install Nix</para>
<screen>
$ export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
$ curl https://nixos.org/nix/install | sh
$ sh &lt;(curl https://nixos.org/nix/install)
</screen></step>
<step><para>In the shell profile and rc files (for example,
@@ -55,7 +55,7 @@ export NIX_SSL_CERT_FILE=/etc/ssl/my-certificate-bundle.crt
the Nix installer will detect the presense of Nix configuration, and
abort.</para></note>
<section>
<section xml:id="sec-nix-ssl-cert-file-with-nix-daemon-and-macos">
<title><envar>NIX_SSL_CERT_FILE</envar> with macOS and the Nix daemon</title>
<para>On macOS you must specify the environment variable for the Nix

View File

@@ -6,13 +6,30 @@
<title>Installing a Binary Distribution</title>
<para>If you are using Linux or macOS, the easiest way to install
Nix is to run the following command:
<para>If you are using Linux or macOS, the easiest way to install Nix
is to run the following command:
<screen>
$ bash &lt;(curl https://nixos.org/nix/install)
$ sh &lt;(curl https://nixos.org/nix/install)
</screen>
As of Nix 2.1.0, the Nix installer will always default to creating a
single-user installation, however opting in to the multi-user
installation is highly recommended.
</para>
<section xml:id="sect-single-user-installation">
<title>Single User Installation</title>
<para>
To explicitly select a single-user installation on your system:
<screen>
sh &lt;(curl https://nixos.org/nix/install) --no-daemon
</screen>
</para>
<para>
This will perform a single-user installation of Nix, meaning that
<filename>/nix</filename> is owned by the invoking user. You should
run this under your usual user account, <emphasis>not</emphasis> as
@@ -33,51 +50,8 @@ and <filename>.profile</filename> to source
the <command>NIX_INSTALLER_NO_MODIFY_PROFILE</command> environment
variable before executing the install script to disable this
behaviour.
</para>
<!--
<para>You can also manually download and install a binary package.
Binary packages of the latest stable release are available for Fedora,
Debian, Ubuntu, macOS and various other systems from the <link
xlink:href="http://nixos.org/nix/download.html">Nix homepage</link>.
You can also get builds of the latest development release from our
<link
xlink:href="http://hydra.nixos.org/job/nix/master/release/latest-finished#tabs-constituents">continuous
build system</link>.</para>
<para>For Fedora, RPM packages are available. These can be installed
or upgraded using <command>rpm -U</command>. For example,
<screen>
$ rpm -U nix-1.8-1.i386.rpm</screen>
</para>
<para>For Debian and Ubuntu, you can download a Deb package and
install it like this:
<screen>
$ dpkg -i nix_1.8-1_amd64.deb</screen>
</para>
-->
<para>You can also download a binary tarball that contains Nix and all
its dependencies. (This is what the install script at
<uri>https://nixos.org/nix/install</uri> does automatically.) You
should unpack it somewhere (e.g. in <filename>/tmp</filename>), and
then run the script named <command>install</command> inside the binary
tarball:
<screen>
alice$ cd /tmp
alice$ tar xfj nix-1.8-x86_64-darwin.tar.bz2
alice$ cd nix-1.8-x86_64-darwin
alice$ ./install
</screen>
</para>
<para>You can uninstall Nix simply by running:
@@ -86,5 +60,131 @@ $ rm -rf /nix
</screen>
</para>
</section>
<section xml:id="sect-multi-user-installation">
<title>Multi User Installation</title>
<para>
The multi-user Nix installation creates system users, and a system
service for the Nix daemon.
</para>
<itemizedlist>
<title>Supported Systems</title>
<listitem>
<para>Linux running systemd, with SELinux disabled</para>
</listitem>
<listitem><para>macOS</para></listitem>
</itemizedlist>
<para>
You can instruct the installer to perform a multi-user
installation on your system:
<screen>
sh &lt;(curl https://nixos.org/nix/install) --daemon
</screen>
</para>
<para>
The multi-user installation of Nix will create build users between
the user IDs 30001 and 30032, and a group with the group ID 30000.
You should run this under your usual user account,
<emphasis>not</emphasis> as root. The script will invoke
<command>sudo</command> as needed.
</para>
<note><para>
If you need Nix to use a different group ID or user ID set, you
will have to download the tarball manually and <link
linkend="sect-nix-install-binary-tarball">edit the install
script</link>.
</para></note>
<para>
The installer will modify <filename>/etc/bashrc</filename>, and
<filename>/etc/zshrc</filename> if they exist. The installer will
first back up these files with a
<literal>.backup-before-nix</literal> extension. The installer
will also create <filename>/etc/profile.d/nix.sh</filename>.
</para>
<para>You can uninstall Nix with the following commands:
<screen>
sudo rm -rf /etc/profile/nix.sh /etc/nix /nix ~root/.nix-profile ~root/.nix-defexpr ~root/.nix-channels ~/.nix-profile ~/.nix-defexpr ~/.nix-channels
# If you are on Linux with systemd, you will need to run:
sudo systemctl stop nix-daemon.socket
sudo systemctl stop nix-daemon.service
sudo systemctl disable nix-daemon.socket
sudo systemctl disable nix-daemon.service
sudo systemctl daemon-reload
# If you are on macOS, you will need to run:
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
</screen>
There may also be references to Nix in
<filename>/etc/profile</filename>,
<filename>/etc/bashrc</filename>, and
<filename>/etc/zshrc</filename> which you may remove.
</para>
</section>
<section xml:id="sect-nix-install-pinned-version-url">
<title>Installing a pinned Nix version from a URL</title>
<para>
NixOS.org hosts version-specific installation URLs for all Nix
versions since 1.11.16, at
<literal>https://nixos.org/releases/nix/nix-VERSION/install</literal>.
</para>
<para>
These install scripts can be used the same as the main
NixOS.org installation script:
<screen>
sh &lt;(curl https://nixos.org/nix/install)
</screen>
</para>
<para>
In the same directory of the install script are sha256 sums, and
gpg signature files.
</para>
</section>
<section xml:id="sect-nix-install-binary-tarball">
<title>Installing from a binary tarball</title>
<para>
You can also download a binary tarball that contains Nix and all
its dependencies. (This is what the install script at
<uri>https://nixos.org/nix/install</uri> does automatically.) You
should unpack it somewhere (e.g. in <filename>/tmp</filename>),
and then run the script named <command>install</command> inside
the binary tarball:
<screen>
alice$ cd /tmp
alice$ tar xfj nix-1.8-x86_64-darwin.tar.bz2
alice$ cd nix-1.8-x86_64-darwin
alice$ ./install
</screen>
</para>
<para>
If you need to edit the multi-user installation script to use
different group ID or a different user ID range, modify the
variables set in the file named
<filename>install-multi-user</filename>.
</para>
</section>
</chapter>

View File

@@ -10,7 +10,7 @@
<itemizedlist>
<listitem><para>Linux (i686, x86_64).</para></listitem>
<listitem><para>Linux (i686, x86_64, aarch64).</para></listitem>
<listitem><para>macOS (x86_64).</para></listitem>

View File

@@ -0,0 +1,21 @@
<chapter 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-upgrading-nix">
<title>Upgrading Nix</title>
<para>
Multi-user Nix users on macOS can upgrade Nix by running
<command>sudo -i sh -c 'nix-channel --update &amp;&amp; nix-env
-iA nixpkgs.nix'; sudo launchctl stop org.nixos.nix-daemon; sudo
launchctl start org.nixos.nix-daemon</command>.
</para>
<para>
Single-user installations of Nix should run <command>nix-channel
--update; nix-env -iA nixpkgs.nix</command>.
</para>
</chapter>

View File

@@ -32,6 +32,7 @@
<xi:include href="introduction/introduction.xml" />
<xi:include href="installation/installation.xml" />
<xi:include href="installation/upgrading.xml" />
<xi:include href="packages/package-management.xml" />
<xi:include href="expressions/writing-nix-expressions.xml" />
<xi:include href="advanced-topics/advanced-topics.xml" />

View File

@@ -4,7 +4,7 @@
version="5.0"
xml:id="ssec-relnotes-2.1">
<title>Release 2.1 (2018-08-??)</title>
<title>Release 2.1 (2018-09-02)</title>
<para>This is primarily a bug fix release. It also reduces memory
consumption in certain situations. In addition, it has the following
@@ -12,6 +12,29 @@ new features:</para>
<itemizedlist>
<listitem>
<para>The Nix installer will no longer default to the Multi-User
installation for macOS. You can still <link
linkend="sect-multi-user-installation">instruct the installer to
run in multi-user mode</link>.
</para>
</listitem>
<listitem>
<para>The Nix installer now supports performing a Multi-User
installation for Linux computers which are running systemd. You
can <link
linkend="sect-multi-user-installation">select a Multi-User installation</link> by passing the
<option>--daemon</option> flag to the installer: <command>sh &lt;(curl
https://nixos.org/nix/install) --daemon</command>.
</para>
<para>The multi-user installer cannot handle systems with SELinux.
If your system has SELinux enabled, you can <link
linkend="sect-single-user-installation">force the installer to run
in single-user mode</link>.</para>
</listitem>
<listitem>
<para>New builtin functions:
<literal>builtins.bitAnd</literal>,
@@ -41,13 +64,70 @@ new features:</para>
<listitem>
<para><command>nix-daemon</command> now respects
<option>--store</option>, so it can be run as a non-root
user.</para>
<option>--store</option>.</para>
</listitem>
<listitem>
<para><command>nix run</command> now respects
<varname>nix-support/propagated-user-env-packages</varname>.</para>
</listitem>
</itemizedlist>
<para>This release has contributions from TODO.
<para>This release has contributions from
Adrien Devresse,
Aleksandr Pashkov,
Alexandre Esteves,
Amine Chikhaoui,
Andrew Dunham,
Asad Saeeduddin,
aszlig,
Ben Challenor,
Ben Gamari,
Benjamin Hipple,
Bogdan Seniuc,
Corey O'Connor,
Daiderd Jordan,
Daniel Peebles,
Daniel Poelzleithner,
Danylo Hlynskyi,
Dmitry Kalinkin,
Domen Kožar,
Doug Beardsley,
Eelco Dolstra,
Erik Arvstedt,
Félix Baylac-Jacqué,
Gleb Peregud,
Graham Christensen,
Guillaume Maudoux,
Ivan Kozik,
John Arnold,
Justin Humm,
Linus Heckemann,
Lorenzo Manacorda,
Matthew Justin Bauer,
Matthew O'Gorman,
Maximilian Bosch,
Michael Bishop,
Michael Fiano,
Michael Mercier,
Michael Raskin,
Michael Weiss,
Nicolas Dudebout,
Peter Simons,
Ryan Trinkle,
Samuel Dionne-Riel,
Sean Seefried,
Shea Levy,
Symphorien Gibol,
Tim Engler,
Tim Sears,
Tuomas Tynkkynen,
volth,
Will Dietz,
Yorick van Pelt and
zimbatm.
</para>
</section>

View File

@@ -30,7 +30,7 @@ rec {
});
configureFlags =
[ "--disable-init-state"
[
"--enable-gc"
] ++ lib.optionals stdenv.isLinux [
"--with-sandbox-shell=${sh}/bin/busybox"

View File

@@ -67,6 +67,14 @@ let
buildInputs = buildDeps;
preConfigure =
# Copy libboost_context so we don't get all of Boost in our closure.
# https://github.com/NixOS/nixpkgs/issues/45462
''
mkdir -p $out/lib
cp ${boost}/lib/libboost_context* $out/lib
'';
configureFlags = configureFlags ++
[ "--sysconfdir=/etc" ];
@@ -74,8 +82,6 @@ let
makeFlags = "profiledir=$(out)/etc/profile.d";
preBuild = "unset NIX_INDENT_MAKE";
installFlags = "sysconfdir=$(out)/etc";
doInstallCheck = true;
@@ -103,8 +109,6 @@ let
enableParallelBuilding = true;
postUnpack = "sourceRoot=$sourceRoot/perl";
preBuild = "unset NIX_INDENT_MAKE";
});
@@ -189,10 +193,6 @@ let
buildInputs = buildDeps;
configureFlags = ''
--disable-init-state
'';
dontInstall = false;
doInstallCheck = true;
@@ -241,6 +241,7 @@ let
{ diskImage = vmTools.diskImages.ubuntu1204x86_64;
}
''
set -x
useradd -m alice
su - alice -c 'tar xf ${binaryTarball.x86_64-linux}/*.tar.*'
mkdir /dest-nix
@@ -249,6 +250,17 @@ let
su - alice -c '_NIX_INSTALLER_TEST=1 ./nix-*/install'
su - alice -c 'nix-store --verify'
su - alice -c 'PAGER= nix-store -qR ${build.x86_64-linux}'
# Check whether 'nix upgrade-nix' works.
cat > /tmp/paths.nix <<EOF
{
x86_64-linux = "${build.x86_64-linux}";
}
EOF
su - alice -c 'nix upgrade-nix -vvv --nix-store-paths-url file:///tmp/paths.nix'
(! [ -L /home/alice/.profile-1-link ])
su - alice -c 'PAGER= nix-store -qR ${build.x86_64-linux}'
mkdir -p $out/nix-support
touch $out/nix-support/hydra-build-products
umount /nix

View File

@@ -30,15 +30,14 @@ if [ "$(uname -s)" = "Darwin" ]; then
fi
fi
# Determine if we should punt to the single-user installer or not
# Determine if we could use the multi-user installer or not
if [ "$(uname -s)" = "Darwin" ]; then
INSTALL_MODE=daemon
echo "Note: a multi-user installation is possible. See https://nixos.org/nix/manual/#sect-multi-user-installation" >&2
elif [ "$(uname -s)" = "Linux" ] && [ -e /run/systemd/system ]; then
INSTALL_MODE=daemon
else
INSTALL_MODE=no-daemon
echo "Note: a multi-user installation is possible. See https://nixos.org/nix/manual/#sect-multi-user-installation" >&2
fi
INSTALL_MODE=no-daemon
# Trivially handle the --daemon / --no-daemon options
if [ "x${1:-}" = "x--no-daemon" ]; then
INSTALL_MODE=no-daemon
@@ -47,14 +46,18 @@ elif [ "x${1:-}" = "x--daemon" ]; then
elif [ "x${1:-}" != "x" ]; then
(
echo "Nix Installer [--daemon|--no-daemon]"
echo "Choose installation method."
echo ""
echo " --daemon: Force the installer to use the Daemon"
echo " based installer, even though it may not"
echo " work."
echo " --daemon: Installs and configures a background daemon that manages the store,"
echo " providing multi-user support and better isolation for local builds."
echo " Both for security and reproducibility, this method is recommended if"
echo " supported on your platform."
echo " See https://nixos.org/nix/manual/#sect-multi-user-installation"
echo ""
echo " --no-daemon: Force a no-daemon, single-user"
echo " installation even when the preferred"
echo " method is with the daemon."
echo " --no-daemon: Simple, single-user installation that does not require root and is"
echo " trivial to uninstall."
echo " (default)"
echo ""
) >&2
exit

View File

@@ -20,14 +20,10 @@ libexpr_LDFLAGS_PROPAGATED = $(BDW_GC_LIBS)
libexpr_ORDER_AFTER := $(d)/parser-tab.cc $(d)/parser-tab.hh $(d)/lexer-tab.cc $(d)/lexer-tab.hh
$(d)/parser-tab.hh: $(d)/parser-tab.cc
$(d)/parser-tab.cc: $(d)/parser.y
$(d)/parser-tab.cc $(d)/parser-tab.hh: $(d)/parser.y
$(trace-gen) bison -v -o $(libexpr_DIR)/parser-tab.cc $< -d
$(d)/lexer-tab.hh: $(d)/lexer-tab.cc
$(d)/lexer-tab.cc: $(d)/lexer.l
$(d)/lexer-tab.cc $(d)/lexer-tab.hh: $(d)/lexer.l
$(trace-gen) flex --outfile $(libexpr_DIR)/lexer-tab.cc --header-file=$(libexpr_DIR)/lexer-tab.hh $<
clean-files += $(d)/parser-tab.cc $(d)/parser-tab.hh $(d)/lexer-tab.cc $(d)/lexer-tab.hh

View File

@@ -219,8 +219,6 @@ static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Va
} else
url = state.coerceToString(pos, *args[0], context, false, false);
if (!isUri(url)) url = absPath(url);
// FIXME: git externals probably can be used to bypass the URI
// whitelist. Ah well.
state.checkURI(url);

View File

@@ -184,8 +184,6 @@ static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * ar
} else
url = state.coerceToString(pos, *args[0], context, false, false);
if (!isUri(url)) url = absPath(url);
// FIXME: git externals probably can be used to bypass the URI
// whitelist. Ah well.
state.checkURI(url);

View File

@@ -131,7 +131,7 @@ struct LegacySSHStore : public Store
auto conn(connections->get());
if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 4) {
if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 5) {
conn->to
<< cmdAddToStoreNar

View File

@@ -305,6 +305,8 @@ void mainWrapped(int argc, char * * argv)
}
}
state->printStats();
auto buildPaths = [&](const PathSet & paths) {
/* Note: we do this even when !printMissing to efficiently
fetch binary cache data. */
@@ -419,7 +421,6 @@ void mainWrapped(int argc, char * * argv)
R"s([ -n "$PS1" ] && PS1='\n\[\033[1;32m\][nix-shell:\w]\$\[\033[0m\] '; )s"
"if [ \"$(type -t runHook)\" = function ]; then runHook shellHook; fi; "
"unset NIX_ENFORCE_PURITY; "
"unset NIX_INDENT_MAKE; "
"shopt -u nullglob; "
"unset TZ; %4%"
"%5%",

View File

@@ -24,7 +24,6 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
{
mkFlag()
.longName("help")
.shortName('h')
.description("show usage information")
.handler([&]() { showHelpAndExit(); });

View File

@@ -78,7 +78,10 @@ struct CmdPathInfo : StorePathsCommand, MixJSON
auto info = store->queryPathInfo(storePath);
storePath = info->path; // FIXME: screws up padding
std::cout << storePath << std::string(std::max(0, (int) pathLen - (int) storePath.size()), ' ');
std::cout << storePath;
if (showSize || showClosureSize || showSigs)
std::cout << std::string(std::max(0, (int) pathLen - (int) storePath.size()), ' ');
if (showSize)
std::cout << '\t' << std::setw(11) << info->narSize;

View File

@@ -173,9 +173,14 @@ void NixRepl::mainLoop(const std::vector<std::string> & files)
printMsg(lvlError, format(error + "%1%%2%") % (settings.showTrace ? e.prefix() : "") % e.msg());
}
if (input.size() > 0) {
// Remove trailing newline before adding to history
input.erase(input.size() - 1);
linenoiseHistoryAdd(input.c_str());
}
// We handled the current input fully, so we should clear it
// and read brand new input.
linenoiseHistoryAdd(input.c_str());
input.clear();
std::cout << std::endl;
}

View File

@@ -1,14 +1,18 @@
#include "command.hh"
#include "common-args.hh"
#include "store-api.hh"
#include "download.hh"
#include "eval.hh"
#include "attr-path.hh"
#include "names.hh"
#include "progress-bar.hh"
using namespace nix;
struct CmdUpgradeNix : StoreCommand
struct CmdUpgradeNix : MixDryRun, StoreCommand
{
Path profileDir;
std::string storePathsUrl = "https://github.com/NixOS/nixpkgs/raw/master/nixos/modules/installer/tools/nix-fallback-paths.nix";
CmdUpgradeNix()
{
@@ -18,6 +22,12 @@ struct CmdUpgradeNix : StoreCommand
.labels({"profile-dir"})
.description("the Nix profile to upgrade")
.dest(&profileDir);
mkFlag()
.longName("nix-store-paths-url")
.labels({"url"})
.description("URL of the file that contains the store paths of the latest Nix release")
.dest(&storePathsUrl);
}
std::string name() override
@@ -59,6 +69,14 @@ struct CmdUpgradeNix : StoreCommand
storePath = getLatestNix(store);
}
auto version = DrvName(storePathToName(storePath)).version;
if (dryRun) {
stopProgressBar();
printError("would upgrade to version %s", version);
return;
}
{
Activity act(*logger, lvlInfo, actUnknown, fmt("downloading '%s'...", storePath));
store->ensurePath(storePath);
@@ -72,11 +90,15 @@ struct CmdUpgradeNix : StoreCommand
throw Error("could not verify that '%s' works", program);
}
stopProgressBar();
{
Activity act(*logger, lvlInfo, actUnknown, fmt("installing '%s' into profile '%s'...", storePath, profileDir));
runProgram(settings.nixBinDir + "/nix-env", false,
{"--profile", profileDir, "-i", storePath, "--no-sandbox"});
}
printError(ANSI_GREEN "upgrade to version %s done" ANSI_NORMAL, version);
}
/* Return the profile in which Nix is installed. */
@@ -98,11 +120,18 @@ struct CmdUpgradeNix : StoreCommand
if (hasPrefix(where, "/run/current-system"))
throw Error("Nix on NixOS must be upgraded via 'nixos-rebuild'");
Path profileDir;
Path userEnv;
Path profileDir = dirOf(where);
// Resolve profile to /nix/var/nix/profiles/<name> link.
while (canonPath(profileDir).find("/profiles/") == std::string::npos && isLink(profileDir))
profileDir = readLink(profileDir);
printInfo("found profile '%s'", profileDir);
Path userEnv = canonPath(profileDir, true);
if (baseNameOf(where) != "bin" ||
!hasSuffix(userEnv = canonPath(profileDir = dirOf(where), true), "user-environment"))
!hasSuffix(userEnv, "user-environment"))
throw Error("directory '%s' does not appear to be part of a Nix profile", where);
if (!store->isValidPath(userEnv))
@@ -115,7 +144,7 @@ struct CmdUpgradeNix : StoreCommand
Path getLatestNix(ref<Store> store)
{
// FIXME: use nixos.org?
auto req = DownloadRequest("https://github.com/NixOS/nixpkgs/raw/master/nixos/modules/installer/tools/nix-fallback-paths.nix");
auto req = DownloadRequest(storePathsUrl);
auto res = getDownloader()->download(req);
auto state = std::make_unique<EvalState>(Strings(), store);