nix-community/nixos-anywhere

How to log in to root from console after nixos-anywhere?

Closed this issue · 2 comments

I've got a box that successfully installs nixos using nixos-anywhere but the network is not coming up. However I can access the console via IPMI. But I don't know what password to use for root, or how to set the root password as part of the nixos-anywhere process ... any suggestions?

Ideally I would be prompted for a root password as part of the nixos-anywhere process so I don't need to store it in a nix config if I don't want to.

The easiest way is to just set https://search.nixos.org/options?channel=unstable&query=users.users..initialHashedPassword in your nixosConfiguration.

Ideally I would be prompted for a root password as part of the nixos-anywhere process so I don't need to store it in a nix config if I don't want to.

To do this properly one would probably have to check whether the nixosConfiguration to install has mutable users enabled or not before running passwd. Won't work on this myself as I don't have a usecase, but would say such a PR would be welcome :)

Thanks @phaer will give that a try!