How to: set up a new machine

  1. Boot into the NixOS installer.

  2. Follow the NixOS manual up to the step of editing configuration.nix.

  3. Set up the initial NixOS configuration file:

    1. On a machine with git push access, create a basic config (a recent example), and push it to GitHub.

    2. On the new machine, set up /mnt/etc/nixos:

      nix-env --install git
      
      cd /mnt/etc/nixos
      
      git clone https://github.com/barrucadu/nixfiles.git
      mv nixos/* nixos/.* .
      rmdir nixos
      
      ln -s hosts/HOSTNAME host
      mv hardware-configuration.nix host/hardware.nix
      
  4. Continue with the NixOS installation instructions, and reboot into the installed OS.

  5. Set up the user environment: NixOS machines generally have ssh and private git access.

  6. Change the barrucadu password and add the new password to KeePassXC.

  7. Disable the root account:

    sudo passwd -l root
    
  8. Change ownership of /etc/nixos to barrucadu:

    sudo chown -R barrucadu.users /etc/nixos
    
  9. Commit and push hardware.nix:

    cd /etc/nixos
    git add .
    git commit -m "[HOSTNAME] Commit generated hardware.nix"
    git remote rm origin
    git remote add origin git@github.com:barrucadu/nixfiles.git
    git push -u origin master