You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/sys-apps/nix/files/nix-2.3-bootstrap.patch

59 lines
1.6 KiB

Fix `nix-channel --update` does not work on freshly-installed nix.
# Why it does not work by default
`nix-channel --update` does two 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
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.
# How we get it working
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
Bug: https://bugs.gentoo.org/693482
Bug: https://github.com/NixOS/nix/issues/2673
--- a/corepkgs/unpack-channel.nix
+++ b/corepkgs/unpack-channel.nix
@@ -6,15 +6,9 @@ let
''
mkdir $out
cd $out
- xzpat="\.xz\$"
- gzpat="\.gz\$"
- if [[ "$src" =~ $xzpat ]]; then
- ${xz} -d < $src | ${tar} xf - ${tarFlags}
- elif [[ "$src" =~ $gzpat ]]; then
- ${gzip} -d < $src | ${tar} xf - ${tarFlags}
- else
- ${bzip2} -d < $src | ${tar} xf - ${tarFlags}
- fi
+
+ tar xf $src
+
if [ * != $channelName ]; then
mv * $out/$channelName
fi
@@ -26,7 +20,7 @@ in
derivation {
system = builtins.currentSystem;
- builder = shell;
+ builder = "/bin/sh";
args = [ "-e" builder ];
inherit name channelName src;