dotfiles/server-quickstart.md
2026-02-27 23:18:57 +01:00

1.2 KiB
Raw Permalink Blame History

NixOS server quick-start

Hostname, user, SSH, key-based login.

0. Installer choice

No Ethernet? Use the graphical ISO (nixos-graphical-*-x86_64-linux.iso). It has NetworkManager and a desktop—join WiFi in the GUI, then use a terminal. The minimal ISO has no GUI and WiFi on the live system is fiddly.

1. Prerequisites

NixOS installed, machine on the network, console or SSH.

2. Hostname

networking.hostName = "myserver";

3. User

users.users.danny = {
  isNormalUser = true;
  extraGroups = [ "wheel" "networkmanager" ];
  # hashedPassword = "...";  # or omit for key-only
};

4. SSH

services.openssh.enable = true;

users.users.danny.openssh.authorizedKeys.keys = [
  "ssh-ed25519 AAAA... your-key-comment"
];

To avoid committing keys (e.g. public repo): omit openssh.authorizedKeys and push keys via scp ~/.ssh/*.pub danny@server:/tmp/ then on server: cat /tmp/*.pub >> ~/.ssh/authorized_keys.

Optional: services.openssh.settings = { PasswordAuthentication = false; PermitRootLogin = "no"; };

5. Apply and test

sudo nixos-rebuild switch
# or: sudo nixos-rebuild switch --flake /path/to/dotfiles/nixos#hostname

Then from your main machine: ssh danny@myserver