Configuration Basics

Welcome! 🎉 This page shows you how to tweak NixOS to fit your needs. No jargon, just plain steps.

A screenshot of the NixOS configuration.nix file

Step‑by‑step guide

  1. Open the main configuration file with your favourite editor:
    sudo nano /etc/nixos/configuration.nix
  2. Add or change options. Here’s a tiny example you can copy‑paste:
    { config, pkgs, ... }:
    
    {
      # Enable the OpenSSH server
      services.openssh.enable = true;
    
      # Give your machine a friendly name
      networking.hostName = "my-nixos-machine";
    
      # Install a simple package so you can test everything works
      environment.systemPackages = with pkgs; [ hello ];
    }
    
  3. Save the file and quit the editor (for nano, press Ctrl + X, then Y, then Enter).
  4. Rebuild the system so the changes take effect:
    sudo nixos-rebuild switch
  5. Verify! For the hostname example, run:
    hostname
    You should see my-nixos-machine. If you installed hello, try hello in the terminal.