NixOS:nixos-rebuild build-vm: Difference between revisions

From NixOS Wiki
imported>Liberatys
mNo edit summary
imported>Korfuri
initialPassword makes the password immediately usable; previously, with initialHashedPassword the user would have needed to hash it and this wasn't indicated
Line 10: Line 10:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
users.users.nixosvmtest.initialHashedPassword = "test";
users.users.nixosvmtest.initialPassword = "test";
</syntaxhighlight>
</syntaxhighlight>



Revision as of 20:43, 5 July 2022

A virtual machine can be created , it will use your /etc/nixos/configuration.nix to make a 'clone' of your system. Useful for testing new configurations.

nixos-rebuild build-vm

You will not be able to login to this virtual machine, as the passwords are not carried over to the virtual machine you build.

If you have a user called nixosvmtest for example, you can add

users.users.nixosvmtest.initialPassword = "test";

to your /etc/nixos/configuration.nix

you should now be able to login and test your system with this user and password.

https://discourse.nixos.org/t/default-login-and-password-for-nixos/4683/2