Change Nixos hostname

Hi. I’m actually playing a lot around with virtual machines and have installed dozens of old and new OS. Some are amazing, other cost lots of time. Nixos 22.11 installs fine on VMware (it seems that the VM must have at least 3GB of RAM; with only 2GB my VM hung during install at 46%), keyboard, display and clock are OK (this is often not the case). However, one problem: I don’t not succeed to change the hostname!
I tried to do

  • in Settings: is immediately reset to “nixos”;
  • using hostname: is reset after boot;
  • using hostnamectl and nmtui: not supported in Nixos!;
  • changing /etc/nixos/configuration.nix: reset after reboot.
    Difficult to understand for a non-professional why not simply asking such info during the OS installation and giving the users a simple possibility to change them. Not doing so is possibly one of the reasons why Linux will never become a serious concurent of Windows…
    Thanks for any suggestions.

How did you make the changes to /etc/nixos/configuration.nix take effect? Did you run nixos-rebuild switch?

1 Like

have look here: NixOS for the Impatient

1 Like

In your configuration.nix there should be an area for your hostname. to find it if you are using vim, in normal mode hit / and type hostname that should bring you to it.

I guess that I have to apologize for having asked this question. You are right: It’s all written down in “NixOS for the Impatient”. And if it did not work for me, it is because I didn’t run nixos-rebuild switch. Thanks for the quick answer and sorry again.
P.S. Would adding a field for the hostname together with the user name not be worth to be considered for the coming releases?