Files
nixos-config/docs/getting-started.md

4.7 KiB

🚀 Getting Started: Fresh Installation & Recovery

This document is the operational procedure for bootstrapping the workstation host (laptop) from bare metal or recovering after a drive replacement.


1. Prerequisites & Installation Media

  1. Download the latest official NixOS Minimal ISO from nixos.org.
  2. Flash the ISO to a USB flash drive:
    sudo dd if=nixos-minimal-*.iso of=/dev/sdX bs=4M status=progress conv=fsync
    
  3. Boot the laptop from the USB drive in UEFI mode.

2. Disk Partitioning & Mounting

Note

Example Reference Partitioning Layout The following partitioning recipe is a standard reference layout for a clean NVMe drive. If recovering an existing drive, or using Btrfs, ZFS, or LUKS encryption, adjust partition identifiers and mount existing subvolumes/filesystems accordingly. The actual filesystem UUIDs and mount options will be captured into system/hardware-configuration.nix in the next step.

Assuming NVMe target drive /dev/nvme0n1:

# 1. Create GPT partition table
parted /dev/nvme0n1 -- mklabel gpt

# 2. EFI System Partition (1GB, FAT32)
parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 1024MiB
parted /dev/nvme0n1 -- set 1 esp on

# 3. Root Partition (remaining space, Ext4 or Btrfs)
parted /dev/nvme0n1 -- mkpart primary ext4 1024MiB 100%

# 4. Format filesystems
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
mkfs.ext4 -L nixos /dev/nvme0n1p2

# 5. Mount targets for installation
mount /dev/disk/by-label/nixos /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-label/BOOT /mnt/boot

3. Clone Repository & Hardware Detection

# Generate hardware configuration scan into a temporary directory
nixos-generate-config --root /mnt

# Clone the declarative workstation configuration
git clone https://github.com/kiskaadee/Config.git /mnt/etc/nixos

# Replace the repository hardware configuration with the generated one
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/system/hardware-configuration.nix

Important

Verify that the filesystem UUIDs in system/hardware-configuration.nix match the output of blkid /dev/nvme0n1p*.


4. Install & Initial System Build

# Enable flakes on the installer shell
export NIX_CONFIG="experimental-features = nix-command flakes"

# Perform initial system installation using the laptop target
nixos-install --flake /mnt/etc/nixos#laptop

# Set root and user passwords when prompted, then reboot:
reboot

5. First Graphical Login & Desktop Bootstrap

  1. Remove the USB flash drive and boot into the installed system.
  2. At the dank-greeter display manager screen, log in as kiskaadee.
  3. Open a terminal (Mod+Return).

Desktop Initialization Phase

On a fresh user profile (or after recreating $HOME), initialize DMS's mutable baseline keybindings with:

dms setup binds

This generates ~/.config/niri/dms/binds.kdl with standard user write permissions (0644).

Important

binds.kdl is not part of the declarative workstation configuration. It is a bootstrap-owned artifact whose initial contents are established by dms setup binds, establishing the DMS-managed Niri IPC integration bindings. Subsequent edits via the DMS Settings GUI or CLI mutate this file directly.

From this point forward:

  • Niri loads all standard DMS IPC shortcuts (Mod+Space for spotlight launcher, Mod+V for clipboard, Mod+M for task manager, Super+X for power menu, volume and brightness controls).
  • DMS owns, updates, and mutates ~/.config/niri/dms/ and ~/.config/DankMaterialShell/settings.json without conflicting with the declarative Nix store.

6. Operator Secrets Bootstrap (Access to Core)

The workstation acts as the administrative cockpit for the homelab. To enable editing and rotating secrets in Core:

  1. Restore your personal age secret key from a secure backup (e.g. Bitwarden or offline medium) into:
    mkdir -p ~/.config/sops/age
    chmod 700 ~/.config/sops/age
    # Place your private key in:
    # ~/.config/sops/age/keys.txt
    chmod 600 ~/.config/sops/age/keys.txt
    
  2. Verify operator decryption capability:
    cd ~/Projects/active/homelab/Core/nixos
    sops secrets.yaml
    

7. Verification Checklist

Check Command Expected Outcome
Flake Validation nix flake check Evaluates with zero errors.
Dry Build nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link Builds cleanly.
Compositor Status niri msg version Reports running Niri version.
DMS Shell Daemon systemctl --user status dms.service Active (running).
Desktop Search systemctl --user status dsearch.service Active (running) on port 43654.