sys-apps/nix: fix nix bootstrap, bug #693482
authorSergei Trofimovich <slyfox@gentoo.org>
Thu, 10 Oct 2019 22:08:33 +0000 (23:08 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Thu, 10 Oct 2019 22:08:48 +0000 (23:08 +0100)
commitd230dd2ca9479868134a2278c8759f03a80e01e7
tree0a51c1ead874e2a89e9d665ec256fb9fa3ac0c3c
parent74477aba21845a608d93dc36c181c2819bad8b76
sys-apps/nix: fix nix bootstrap, bug #693482

Fix `nix-channel --update` does not work on freshly-installed nix.

`nix-channel --update` does a few main things:
1. fetch new tarball with nix expressions
2. unpack that tarball as part of the build system using
   a shell script derived by unpack-channel.nix.
3. install the result into /nix/store

[2.] fails because tarball unpacking runs in a sandboxed environment
in a container with /nix/store and /bin/sh mounted.

unpack-channel.nix needs bash, tar and xz binaries in PATH.
These are normally provided by bash, tar and xz packages from /nix/store.

Unfortunately bash, tar and xz packages are not yet fetched as we
only have nix installed without nixpkgs tree.

1. we patch unpack-channel.nix to only require 'sh'
2. we use /bin/sh as a static busybox and point nix at it:
   ./configure --with-sandbox-shell=/bin/busybox

Reported-by: Kirill Zaborsky
Closes: https://bugs.gentoo.org/693482
Bug: https://github.com/NixOS/nix/issues/2673
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
sys-apps/nix/files/nix-2.3-bootstrap.patch [new file with mode: 0644]
sys-apps/nix/nix-2.3-r1.ebuild [new file with mode: 0644]