Files
nixy/INSTALL-laptop.md
T
KptltD00M 40ccfd34ab docs: add ThinkPad NixOS installation guide
Add comprehensive installation guide for ThinkPad laptops in INSTALL-laptop.md, covering:
- Prerequisites and preparation steps
- Detailed disk partitioning and formatting instructions
- NixOS installation and configuration process
- ThinkPad-specific optimizations (trackpad, keyboard backlight, power management)
- Troubleshooting section for common issues
- Maintenance and update procedures

Includes ThinkPad T480/X1 Carbon specific configurations and hardware-specific optimizations.
2026-06-24 21:17:51 +02:00

4.9 KiB

ThinkPad NixOS Installation Guide

This guide provides step-by-step instructions for installing the NixOS configuration on your ThinkPad laptop.

Prerequisites

  • ThinkPad laptop (tested models: T480, T490, X1 Carbon)
  • USB flash drive (8GB+ recommended)
  • Backup your data - this will erase everything on the target device
  • NixOS ISO - Download from nixos.org
  • Internet connection (wired recommended for initial setup)

Preparation

1. Create NixOS Installation Media

# On another Linux machine or macOS:
sudo dd if=nixos-minimal-*.iso of=/dev/sdX bs=4M status=progress oflag=sync
# Replace /dev/sdX with your USB device (e.g., /dev/sdb)
# WARNING: This will erase the target device completely

2. Boot from USB

  1. Insert USB drive into ThinkPad
  2. Power on and press F12 to enter boot menu
  3. Select the USB drive
  4. At GRUB menu, select "NixOS"

Installation Steps

3. Prepare Disks

# Identify your disk (likely /dev/nvme0n1 for NVMe SSDs)
lsblk

# Partition the disk (adjust for your needs)
sudo gdisk /dev/nvme0n1
# Use: o (create new GPT), n (new partition), accept defaults for EFI (512M), then Linux filesystem (rest)
# Set type for EFI to EF00, Linux filesystem to 8300
# Write changes with w

4. Format Partitions

# Format EFI partition
sudo mkfs.fat -F32 /dev/nvme0n1p1

# Format root partition
sudo mkfs.ext4 /dev/nvme0n1p2

# Mount partitions
sudo mount /dev/nvme0n1p2 /mnt
sudo mkdir -p /mnt/boot/efi
sudo mount /dev/nvme0n1p1 /mnt/boot/efi

5. Generate NixOS Configuration

# Generate initial configuration
sudo nixos-generate-config --root /mnt

# This creates /mnt/etc/nixos/configuration.nix and hardware-configuration.nix

6. Clone Your Nixy Configuration

# Clone your nixy repository
sudo nix-shell -p git
git clone https://gitea.doomlabs.de/KptltD00M/nixy.git /mnt/etc/nixos/nixy
cd /mnt/etc/nixos/nixy

# Copy hardware configuration
sudo cp /mnt/etc/nixos/hardware-configuration.nix hosts/laptop/hardware-configuration.nix

7. Install NixOS

# Switch to your laptop configuration
sudo nixos-install --flake /mnt/etc/nixos/nixy#laptop

# When prompted, set a root password

8. Post-Installation

# After reboot, log in as root
# Clone your configuration to your user
git clone https://gitea.doomlabs.de/KptltD00M/nixy.git ~/nixy
cd ~/nixy

# Switch to your user configuration
nix run nixpkgs#home-manager -- switch --flake .#andi@laptop

# Reboot
reboot

ThinkPad-Specific Configuration

1. Trackpad Configuration

The configuration includes touchpad settings optimized for ThinkPad hardware. If you need to adjust:

# Edit hosts/laptop/home.nix
programs.hyprland = {
  touchpad = {
    naturalScroll = true;
    tap-to-click = true;
    disableWhileTyping = false;
  };
};

2. Keyboard Backlight

# Enable keyboard backlight control
sudo nix-env -iA nixos.hid-tools
sudo systemctl enable --now thinkpad-keyboard-backlight.service

3. Power Management

# Install TLP for better power management
sudo nix-env -iA nixos.tlp
sudo systemctl enable --now tlp

Troubleshooting

Common Issues

1. WiFi not working:

# Install firmware for your WiFi card
sudo nix-env -iA nixos.firmware

2. Suspend/resume issues:

# Edit hardware-configuration.nix
boot.kernelPackages = pkgs.linuxPackages_latest;

3. Screen tearing:

# Enable TearFree in hosts/laptop/configuration.nix
services.xserver.videoDrivers = [ "modesetting" ];

Debugging Commands

# Check hardware detection
sudo dmesg | grep -i thinkpad

# Check battery status
upower -i /org/freedesktop/UPower/devices/battery_BAT0

# Check display configuration
hyprctl monitors

Maintenance

Updating Your System

# Update flake inputs
nix flake update

# Rebuild system
sudo nixos-rebuild switch --flake ~/nixy#laptop

# Rebuild home configuration
nix run nixpkgs#home-manager -- switch --flake ~/nixy#andi@laptop

Backup Configuration

# Backup your hardware configuration
cp /etc/nixos/hardware-configuration.nix ~/nixy/hosts/laptop/

# Commit changes
cd ~/nixy
git add .
git commit -m "Update hardware config for ThinkPad"
git push

Additional Resources

Notes

  • ThinkPad T480/X1 Carbon specific: These models have excellent Linux support. The configuration includes:

    • Trackpoint acceleration settings
    • Keyboard backlight control
    • Power management profiles
    • Display brightness controls
    • Suspend/resume fixes
  • Encryption: If you enabled encryption during install, use:

    sudo cryptsetup luksOpen /dev/nvme0n1p2 cryptroot
    sudo mount /dev/mapper/cryptroot /mnt
    
  • Multi-boot: If dual-booting with Windows, ensure Secure Boot is disabled in BIOS.