nixos-config/hosts/electra/README.md

98 lines
4 KiB
Markdown

# Electra Setup Specifics
**Machine:** Framework 16 (Ryzen 7940HS + RTX 7700S / RTX 5070)
## 1. BIOS Configuration (Crucial)
Before booting NixOS, you must configure the BIOS to handle the memory split for LLMs and performance:
1. Reboot and enter BIOS (F2 or Del).
2. Find **Graphics Memory**, **UMA Frame Buffer**, or **iGPU Memory**.
3. Set this to **16G** (or "Game Optimized").
## 2. Disk Partitioning (Btrfs)
Electra uses a 2TB NVMe with a dedicated boot partition and a flat Btrfs subvolume layout.
### Step 1: Subvolume Creation (If Reinstalling)
```bash
# Mount the main partition (nvme0n1p2)
mount /dev/nvme0n1p2 /mnt
# Standard subvolumes
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@nix
btrfs subvolume create /mnt/@log
btrfs subvolume create /mnt/@cache
btrfs subvolume create /mnt/@tmp
btrfs subvolume create /mnt/@srv
umount /mnt
```
### Step 2: Mount with Optimizations
```bash
# Mount Root
mount -o subvol=@,compress=zstd,noatime /dev/nvme0n1p2 /mnt
# Create mount points
mkdir -p /mnt/{home,nix,var/log,var/cache,var/tmp,srv,boot}
# Mount subvolumes
mount -o subvol=@home,compress=zstd,noatime /dev/nvme0n1p2 /mnt/home
mount -o subvol=@nix,compress=zstd,noatime /dev/nvme0n1p2 /mnt/nix
mount -o subvol=@log,compress=zstd,noatime /dev/nvme0n1p2 /mnt/var/log
mount -o subvol=@cache,compress=zstd,noatime /dev/nvme0n1p2 /mnt/var/cache
mount -o subvol=@tmp,compress=zstd,noatime /dev/nvme0n1p2 /mnt/var/tmp
mount -o subvol=@srv,compress=zstd,noatime /dev/nvme0n1p2 /mnt/srv
# Mount Boot (8GB partition)
mount /dev/nvme0n1p1 /mnt/boot
```
## 3. Boot Specialisations
Electra has specialized boot modes selectable at startup (systemd-boot menu):
### With dGPU (Graphics Module Installed)
1. **NixOS Default:** NVIDIA + Balanced Power (Standard mode).
2. **Gaming-Zen:** NVIDIA + Zen Kernel + Max Performance (Lower latency/Stutter reduction).
3. **dGPU-Battery:** NVIDIA + TLP (Max energy saving while using dGPU).
### Without dGPU (Expansion Shell Installed)
4. **No-dGPU:** **iGPU Only** + Balanced Power.
5. **No-dGPU-Battery:** **iGPU Only** + TLP Power Saving.
**Note:** The `dgpu-guard` service is active on modes 1-3 to prevent black screens if the hardware is missing.
## 4. Long-Term dGPU Removal (Expansion Shell Mode)
If you plan to leave the dGPU module out for an extended period, you have two options to make the boot process seamless:
### Option A: The "Sticky" Default (Recommended)
You don't need to change any code.
1. Reboot Electra.
2. At the **systemd-boot** menu, use the arrow keys to highlight the `No-dGPU` (or `No-dGPU-Battery`) entry.
3. Press **'d'** (for Default).
4. The bootloader will now automatically highlight and boot this entry every time until you change it back.
### Option B: The Physical Swap Workflow
1. **Shutdown** and unplug the charger.
2. Move the lock switches on the back of the Framework 16 and pull the dGPU module out.
3. Slide the **Expansion Shell** (the empty fan-only module) in and lock it.
4. **Boot**: The system will attempt to boot the Default (Nvidia) mode, hit the `dgpu-guard`, and stop at the console.
5. **Reboot** and perform **Option A** to set your new long-term default.
## 5. Hardware Identifiers & PCI Shift
**Important:** On the Framework 16, PCI Bus IDs shift depending on whether the dGPU is physically installed.
| Component | dGPU Installed (ID) | dGPU Removed (ID) |
| :--- | :--- | :--- |
| **NVIDIA dGPU** | `PCI:193:0:0` (c1) | *N/A* |
| **AMD iGPU** | `PCI:194:0:0` (c2) | `PCI:193:0:0` (c1) |
### Impact on Boot Modes:
* **Default / Gaming-Zen / Eco-Battery**: These modes **require** the dGPU to be physically installed. Booting them without the dGPU may cause the Nvidia driver to conflict with the iGPU.
* **No-dGPU**: Use this mode whenever the Expansion Bay is removed. It ignores Bus IDs and works regardless of the shift.
## 5. Fingerprint Reader
* **Login:** Password required (KWallet compatibility).
* **Sudo / Lock Screen:** Fingerprint enabled.
* **Enrollment:** `fprintd-enroll nimmo`