Change:
the runChroot code in nixos-install was removed in it will now try to do a full install if you run cc
I'll try to restore before 17.09 branch point, sorry!
Okay I'm looking at this now. I'm not entirely clear on the flag's purpose, so it's hard for me to add it back (even looking at the old code), and it doesn't really appear to be documented except that it gets mentioned in the manual once in passing. Can someone elaborate on what it's for and what it's guarding against? That'll make it much easier for me to add it back. Edit: the commit message clarifies some of it. I guess it's chroot + some bind mounts to make the chroot usable? It feels a little odd to stick that under but I guess I should replicate that behavior.
Okay, I get what it's supposed to do. is just "set up a few bind mounts like /proc to make it look legit, and then chroot", right? It has nothing to do with installation except that one might want to use it to test a fresh install (but one might also want to use it to test an unfresh install mounted on another machine, or something).
Also useful to fix a broken installation, e.g. when you broke your boot loader or something similar severe. Then you can boot from usb, run and then do a rebuild, and everything works again.
Cool! do you have a good test setup for my PR addressing this? My access to physical NixOS boxes for testing is limited right now.
the hardware's here, but did not manage to get your PR version running on my NixOS live usb key to try it, or somehow mount a snapshot of my actual installation and trick nixos-install into chrooting into that.
Note that on Arch Linux, and are two separate tools, and , which would at least make it easier to test this skipping all that mount point checking, as well as more flexible. And it would also prevent the confusion on what does in the first place.
ping We only have a few days left until the release. :)
I've updated the PR, sorry!

Discussion:
extraBuildFlags+=(--option "build-users-group" "$buildUsersGroup") # Inherit binary caches from the host <del> # TODO: will this still work with Nix 1.12 now that it has no perl? Probably not... </del> <ins> # TODO: will this still work with Nix 1.12 now that it has no perl? Probably not... </ins> binary_caches="$(@perl@/bin/perl -I @nix@/lib/perl5/site_perl/*/* -e 'use Nix::Config; Nix::Config::readConfig; print $Nix::Config::config{"binary-caches"};')" extraBuildFlags+=(--option "binary-caches" "$binary_caches")

export NIX_PATH="nixpkgs=$nixpkgs:nixos-config=$mountPoint/$NIXOS_CONFIG" unset NIXOS_CONFIG <del> # TODO: do I need to set NIX_SUBSTITUTERS here or is the --option binary-caches above enough? </del> <ins> # These get created in nixos-prepare-root as well, but we want to make sure they're here in case we're # running with --chroot. TODO: --chroot should just be split into a separate tool. mkdir -m 0755 -p "$mountPoint/dev" "$mountPoint/proc" "$mountPoint/sys" # Set up some bind mounts we'll want regardless of chroot or not mount --rbind /dev "$mountPoint/dev" mount --rbind /proc "$mountPoint/proc" mount --rbind /sys "$mountPoint/sys" # If we asked for a chroot, that means we're not actually installing anything (yeah I was confused too) # and we just want to run a command in the context of a $mountPoint that we're assuming has already been # set up by a previous nixos-install invocation. In that case we set up some remaining bind mounts and # exec the requested command, skipping the rest of the installation procedure. if [ -n "$runChroot" ]; then mount -t tmpfs -o "mode=0755" none $mountPoint/run rm -rf $mountPoint/var/run ln -s /run $mountPoint/var/run for f in /etc/resolv.conf /etc/hosts; do rm -f $mountPoint/$f; [ -f "$f" ] && cp -Lf $f $mountPoint/etc/; done for f in /etc/passwd /etc/group;      do touch $mountPoint/$f; [ -f "$f" ] && mount --rbind -o ro $f $mountPoint/$f; done if ! [ -L $mountPoint/nix/var/nix/profiles/system ]; then echo "$0: installation not finished; cannot chroot into installation directory" exit 1 fi ln -s /nix/var/nix/profiles/system $mountPoint/run/current-system exec chroot $mountPoint "${chrootCommand[@]}" fi </ins> # A place to drop temporary closures trap "rm -rf $tmpdir" EXIT

# nixos-prepare-root doesn't currently do anything with file ownership, so we set it up here instead chown @root_uid@:@nixbld_gid@ $mountPoint/nix/store <del> mount --rbind /dev $mountPoint/dev mount --rbind /proc $mountPoint/proc mount --rbind /sys $mountPoint/sys </del> # Grub needs an mtab. ln -sfn /proc/mounts $mountPoint/etc/mtab