NixOS Default Behavior Confusing

New to Nix. Installed NixOS on a pi.

Doing basic configurations and it seems ssh via root is not allowed, tried to change the sshd config file and it’s read only even as root or using sudo, but I can ssh using the nixos default user and it connects no password no keys.

I am 1k percent confused by this.

Maybe I followed a bad set of instructions, not sure. Can someone point me to a noob friendly instructions for installing NixOS and doing basic networking and user account configs?

Thx.

Try following this guide Installing NixOS on a Raspberry Pi — nix.dev documentation (official docs) if you haven’t already.


Once you’ve followed the official docs you could try these links:

I’ve found myme.no - NixOS: On Raspberry Pi 3B to be pretty good (for flakes setup) and if you’re feeling ambitious GitHub - plmercereau/nixos-pi-zero-2 (you can use this as a base to install onto a different kind of Pi; I’ve used it for Pi3B+ but it’ll work for others)

The NixOS configuration model is indeed different, and can be confusing if you have different expectations from other systems.

The basic realisation is that you don’t edit confguration files like /etc/ssh/sshd_config; these files are generated from nix code and settings. You edit and organise and version control nix content instead, all in one place with one syntax.

So, for example, whether root can log in via ssh is controlled using
services.openssh.settings.PermitRootLogin

There’s a learning curve, but eventually many of us wind up being confused why anyone would ever want to instead manage a system with 1000 different files each with their own syntax, idioms, tools, no version control, etc.

3 Likes