Nixpkgs: nixos-install --chroot option

Created on 19 Jan 2018  路  7Comments  路  Source: NixOS/nixpkgs

Reposting from: https://github.com/NixOS/nixpkgs/commit/186c120bed6b5d4a9b1549159aa567005402000c#commitcomment-26939448

@copumpkin This --chroot option is a bit strange. It enabled me to rebuild my corrupted boot partition by basically setting up my OS while booted in via USB NixOS distro. However before I could I actually run nixos-rebuild, I needed to create /run/user/0. Perhaps this --chroot option should also do this as well. Otherwise it cannot create the temporary files/directories for running nixos-rebuild.

I also had to be careful with NIXOS_CONFIG setting (because the configuration.nix) may not be at the default position. And afterwards NIX_PATH when invoking the nixos-rebuild.

stale

Most helpful comment

The nixos-install's man page mentions the --chroot option, but it isn't currently implemented! This is quite confusing. Can we merge the code that re-enables it (https://github.com/NixOS/nixpkgs/commit/186c120bed6b5d4a9b1549159aa567005402000c)?

Luckily, there is now the separate nixos-enter utility that has the same functionality. So I suppose the proper course of actions would be to re-enable nixos-install --chroot but add a deprecation warning that points to nixos-enter.

All 7 comments

Perhaps systemd-nspawn would be a better option for entering the system properly?

The nixos-install's man page mentions the --chroot option, but it isn't currently implemented! This is quite confusing. Can we merge the code that re-enables it (https://github.com/NixOS/nixpkgs/commit/186c120bed6b5d4a9b1549159aa567005402000c)?

Luckily, there is now the separate nixos-enter utility that has the same functionality. So I suppose the proper course of actions would be to re-enable nixos-install --chroot but add a deprecation warning that points to nixos-enter.

@pvgoran Do you use nixos-enter while booted inside the USB NixOS after running nixos-install? It might be useful to use to run some pre-initilisation before rebooting after installing.

@CMCDragonkai I run nixos-enter after nixos-install from a working NixOS in order to prepare a fresh, runnable NixOS tree for transfer to a different machine. (I also manually create /tmp because of #39140.)

FWIW I removed the --chroot option from the docs in 152454d9875cc1df645c5aa01ec41451d985199f (#39798)

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

Closing, as AFAIU the issue no longer exists as the option itself no longer exists.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nico202 picture nico202  路  70Comments

7c6f434c picture 7c6f434c  路  66Comments

samueldr picture samueldr  路  88Comments

Infinisil picture Infinisil  路  146Comments

thoughtpolice picture thoughtpolice  路  71Comments