Skip to content

NixOS configs to keep my workspace identical across all my laptops, desktops and VMs.

License

Notifications You must be signed in to change notification settings

dhilipsiva/.files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.files

Setting up nixOS machines

Detailed Documentation for Manual Installation of NixOS (Minimal ISO)

This guide will take you through the process of installing NixOS using the minimal ISO, configuring a LUKS-encrypted root partition, setting up UEFI (GPT) partitioning, and other installation steps. We'll also use SSH for remote installation to make copying commands and configurations easier.

Step 1: Create a Bootable USB

Use balena Etcher to create a bootable USB drive from the NixOS minimal ISO:

  1. Download the minimal NixOS ISO from the NixOS Downloads Page.
  2. Install and open balena Etcher.
  3. Select the NixOS ISO, choose your USB drive, and click "Flash".

Step 2: Boot into Live CD

  1. Insert the USB drive into your machine and boot from the USB.
  2. At the NixOS boot menu, select the first option to enter the live environment.

Step 3: Configure Network

For wireless network configuration, follow these steps:

  1. Start the wireless service:

    sudo systemctl start wpa_supplicant
  2. Open the wireless control interface:

    wpa_cli
  3. Configure your network:

    Inside wpa_cli:

    add_network
    set_network 0 ssid "myhomenetwork"
    set_network 0 psk "mypassword"
    set_network 0 key_mgmt WPA-PSK
    enable_network 0
  4. You should see a message like this if the network is successfully connected:

    <3>CTRL-EVENT-CONNECTED - Connection to 32:85:ab:ef:24:5c completed [id=0 id_str=]
  5. Check your IP address:

    ip a

Step 4: Set a Root Password and Start SSH

  1. Set a password for the root user:

    passwd
  2. Start the SSH service:

    sudo systemctl start sshd

Step 5: Connect via SSH from Another System

Now, connect to the live environment from another computer:

  1. On your other system, use SSH to connect:

    ssh root@<ip_address>

    Replace <ip_address> with the IP you found in Step 3.5.

Step 6: UEFI (GPT) Partitioning and Formatting

You will now partition and format your disk. Note: Replace /dev/nvme0n1 with your actual disk device if it's different.

  1. To identify your target disk:

    lsblk

    In this example, we assume /dev/nvme0n1 is the intended disk. Adjust commands as needed for your disk.

  2. Partition the disk using parted:

    parted /dev/nvme0n1 -- mklabel gpt
    parted /dev/nvme0n1 -- mkpart primary 512MiB -100MiB
    parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 512MiB
    parted /dev/nvme0n1 -- set 2 boot on
  3. Format the /boot partition:

    mkfs.vfat -F 32 -n BOOT /dev/nvme0n1p2
  4. Set up LUKS encryption for the root partition:

    cryptsetup luksFormat /dev/nvme0n1p1
    cryptsetup open /dev/nvme0n1p1 root
    mkfs.ext4 /dev/mapper/root
  5. Mount the partitions:

    mount /dev/mapper/root /mnt
    mkdir -p /mnt/boot
    mount /dev/nvme0n1p2 /mnt/boot

Step 7: Generate and Update NixOS Configuration

  1. Generate the default NixOS configuration:

    nixos-generate-config --root /mnt
  2. Edit /mnt/etc/nixos/configuration.nix and replace its content with the configuration from your repo or personal setup.

Step 8: Install NixOS

  1. Install NixOS:

    nixos-install
  2. During installation, you’ll be asked to set the root password.

  3. Set a password for your user (replace dhilipsiva with your actual username):

    nixos-enter --root /mnt -c 'passwd dhilipsiva'

Step 9: Reboot into Your New System

After installation, reboot the system:

reboot

Your system should now boot into your new NixOS installation.

Step 10: Troubleshooting Boot Issues

If your system has trouble booting or logging in, you can boot back into the live USB, decrypt and mount the LUKS-encrypted partition, and make any necessary changes to the configuration.

  1. List available block devices to find your partitions:

    lsblk
  2. Open the LUKS-encrypted partition:

    cryptsetup luksOpen /dev/nvme0n1p1 luks-root
  3. Mount the partitions:

    mount /dev/mapper/luks-root /mnt
    mount /dev/nvme0n1p2 /mnt/boot
  4. Make changes to the NixOS configuration:

    nano /mnt/etc/nixos/configuration.nix
  5. Reinstall the configuration:

    nixos-install --root /mnt
  6. Reboot:

    reboot

Additional Notes:

  • For systems with 16GB+ RAM, swap is generally unnecessary.
  • If issues arise with networking or disk detection, ensure you check the partition layout and use tools like lsblk and fdisk to verify the correct devices.

About

NixOS configs to keep my workspace identical across all my laptops, desktops and VMs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published