refactor: Restructure NixOS configuration to a flake-based multi-host setup with common and host-specific modules.
This commit is contained in:
parent
c69c8fa81e
commit
afadfd68dd
8 changed files with 351 additions and 472 deletions
343
README.md
343
README.md
|
|
@ -1,290 +1,147 @@
|
||||||
# Nimmo's NixOS Setup Guide (Host: electra)
|
# Nimmo's NixOS Configurations (Electra & Lena)
|
||||||
|
|
||||||
## 0. Pre-Installation Preparation (Do this NOW on CachyOS)
|
This repository manages the NixOS configurations for multiple machines using **Flakes**.
|
||||||
|
|
||||||
Since you are hosting this on `git.nimmog.uk`, we will create the config locally and push it before booting the installer.
|
* **Electra:** Framework 16 (Strix Point + RTX 5070) - High Performance / Gaming.
|
||||||
|
* **Lena:** Secondary Laptop - Standard / Light Use.
|
||||||
|
|
||||||
1. **Create the Repository on your Server:**
|
## 1. Directory Structure
|
||||||
|
|
||||||
* Log into `https://git.nimmog.uk`.
|
* `common/`: Shared configuration (Users, GUI Apps, CLI Tools, Fonts, Plasma Settings).
|
||||||
|
* `hosts/electra/`: Electra-specific hardware config, kernel parameters, and strict boot modes.
|
||||||
|
* `hosts/lena/`: Lena-specific hardware config.
|
||||||
|
* `flake.nix`: Entry point defining both hosts.
|
||||||
|
|
||||||
* Create a new **empty** repository named `nixos-config`.
|
---
|
||||||
|
|
||||||
* *Do not initialize with README or license (keep it empty).*
|
## 2. Initial Setup (Electra Only - BIOS)
|
||||||
|
|
||||||
2. **Create Files Locally:**
|
**Crucial:** Before booting NixOS on Electra, you must configure the BIOS to handle the memory split for LLMs.
|
||||||
Open a terminal in CachyOS:
|
|
||||||
|
|
||||||
```
|
1. Reboot and enter BIOS (F2 or Del).
|
||||||
mkdir ~/nixos-config
|
2. Find **Graphics Memory**, **UMA Frame Buffer**, or **iGPU Memory**.
|
||||||
cd ~/nixos-config
|
3. Set this to **16G** (or "Game Optimized").
|
||||||
|
|
||||||
# Run the creation script provided by Gemini to generate files here
|
---
|
||||||
```
|
|
||||||
|
|
||||||
3. **Initialize & Push:**
|
## 3. Installation Guide
|
||||||
|
|
||||||
```
|
Once you have booted the **NixOS Unstable ISO**:
|
||||||
git init
|
|
||||||
git branch -M main
|
|
||||||
git add .
|
|
||||||
git commit -m "Initial commit: Setup for electra"
|
|
||||||
|
|
||||||
# Replace with your actual SSH or HTTPS URL
|
### Step 1: Disk Partitioning & Mounting
|
||||||
git remote add origin https://git.nimmog.uk/YOUR_USERNAME/nixos-config.git
|
|
||||||
git push -u origin main
|
|
||||||
```
|
|
||||||
|
|
||||||
## 1. Initial BIOS Setup (Crucial)
|
Follow standard NixOS procedure (or see previous version of this README for BTRFS subvolume layout). Mount your root to `/mnt`.
|
||||||
|
|
||||||
Before booting NixOS, you must configure the BIOS to handle the memory split for your LLMs.
|
### Step 2: Clone Configuration
|
||||||
|
|
||||||
1. Reboot and enter BIOS (usually F2 or Del).
|
We will clone the repo into the user's Scripts folder (persistent location), but for installation we can clone it temporarily or directly to the target.
|
||||||
|
|
||||||
2. Find **Graphics Memory**, **UMA Frame Buffer**, or **iGPU Memory**.
|
**Recommended approach for Install:**
|
||||||
|
|
||||||
3. Set this to **16G** (or "Game Optimized" if it equates to high memory).
|
1. **Clone to /mnt/etc/nixos (Temporary):**
|
||||||
|
|
||||||
## 2. Installation
|
```bash
|
||||||
|
# Replace USERNAME with your git user
|
||||||
|
nix-shell -p git --run "git clone https://git.nimmog.uk/nimmo/nixos-config.git /mnt/etc/nixos"
|
||||||
|
```
|
||||||
|
|
||||||
Once you have booted the **NixOS Unstable ISO**, choose your path below.
|
2. **Generate Hardware Config:**
|
||||||
|
|
||||||
### Path A: Fresh Install (Wipe Everything)
|
```bash
|
||||||
|
nixos-generate-config --root /mnt
|
||||||
|
```
|
||||||
|
|
||||||
*Use this if you want to start completely fresh.*
|
3. **Move Hardware Config to Correct Host Folder:**
|
||||||
|
|
||||||
1. **Partition:** `cfdisk /dev/nvme0n1` (Delete all, Create 4G Boot + Remaining Root).
|
**For Electra:**
|
||||||
|
```bash
|
||||||
|
mv /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/hosts/electra/hardware-configuration.nix
|
||||||
|
```
|
||||||
|
|
||||||
2. **Format:**
|
**For Lena:**
|
||||||
|
```bash
|
||||||
|
mv /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/hosts/lena/hardware-configuration.nix
|
||||||
|
```
|
||||||
|
|
||||||
```
|
### Step 3: Install & Set Password
|
||||||
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
|
|
||||||
mkfs.btrfs -L nixos /dev/nvme0n1p2
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Create Subvolumes:**
|
1. **Run the Installer:**
|
||||||
|
|
||||||
```
|
**For Electra:**
|
||||||
mount /dev/nvme0n1p2 /mnt
|
```bash
|
||||||
btrfs subvolume create /mnt/@
|
nixos-install --flake /mnt/etc/nixos#electra
|
||||||
btrfs subvolume create /mnt/@home
|
```
|
||||||
btrfs subvolume create /mnt/@nix
|
|
||||||
umount /mnt
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Proceed to Step "Mounting" below.**
|
**For Lena:**
|
||||||
|
```bash
|
||||||
|
nixos-install --flake /mnt/etc/nixos#lena
|
||||||
|
```
|
||||||
|
|
||||||
### Path B: Migration (Keep /home data)
|
2. **Set User Password:**
|
||||||
|
Do not reboot yet!
|
||||||
|
|
||||||
*Use this to delete CachyOS but KEEP your existing data in `@home`.*
|
```bash
|
||||||
|
nixos-enter
|
||||||
|
passwd nimmo
|
||||||
|
exit
|
||||||
|
```
|
||||||
|
|
||||||
1. **Mount the Top-Level Partition:**
|
3. **Reboot:** `reboot`
|
||||||
|
|
||||||
```
|
---
|
||||||
mount /dev/nvme0n1p2 /mnt
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **List & Cleanup:**
|
## 4. Post-Installation & Management
|
||||||
Run `ls -a /mnt`.
|
|
||||||
**Delete the OLD Operating System:**
|
|
||||||
*Warning: Be extremely careful. Do NOT delete `@home`.*
|
|
||||||
|
|
||||||
```
|
After rebooting, move your config to your home folder for easier management.
|
||||||
# Delete the old root and system folders
|
|
||||||
btrfs subvolume delete /mnt/@
|
|
||||||
btrfs subvolume delete /mnt/@root
|
|
||||||
btrfs subvolume delete /mnt/@srv
|
|
||||||
btrfs subvolume delete /mnt/@log
|
|
||||||
btrfs subvolume delete /mnt/@cache
|
|
||||||
btrfs subvolume delete /mnt/@tmp
|
|
||||||
btrfs subvolume delete /mnt/@.snapshots
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Prepare NixOS Subvolumes:**
|
1. **Move Config:**
|
||||||
|
```bash
|
||||||
|
mkdir -p ~/Scripts
|
||||||
|
sudo mv /etc/nixos ~/Scripts/nixos-config
|
||||||
|
sudo chown -R nimmo:users ~/Scripts/nixos-config
|
||||||
|
```
|
||||||
|
|
||||||
```
|
2. **Apply Changes:**
|
||||||
btrfs subvolume create /mnt/@
|
From now on, edit files in `~/Scripts/nixos-config`.
|
||||||
btrfs subvolume create /mnt/@nix
|
|
||||||
```
|
|
||||||
|
|
||||||
*(Note: Ensure your existing home data is in a subvolume named `@home`.)*
|
* **Edit:** `nano ~/Scripts/nixos-config/common/user-apps.nix` (or other files)
|
||||||
|
* **Rebuild (Electra):**
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake ~/Scripts/nixos-config/#electra
|
||||||
|
```
|
||||||
|
* **Rebuild (Lena):**
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake ~/Scripts/nixos-config/#lena
|
||||||
|
```
|
||||||
|
|
||||||
4. **Format Boot Partition:**
|
3. **Adding Apps:**
|
||||||
|
* **CLI Tools:** Edit `common/system-utils.nix`
|
||||||
|
* **GUI Apps:** Edit `common/user-apps.nix`
|
||||||
|
|
||||||
```
|
---
|
||||||
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
|
|
||||||
```
|
|
||||||
|
|
||||||
5. **Unmount:**
|
## 5. Electra Specifics
|
||||||
|
|
||||||
```
|
### Boot Modes
|
||||||
umount /mnt
|
Electra has specialized boot modes selectable at startup:
|
||||||
```
|
|
||||||
|
|
||||||
### Mounting (Common for Both Paths)
|
1. **NixOS Default:** NVIDIA + Balanced Power (Use when GPU module is inserted).
|
||||||
|
2. **Gaming-Zen:** NVIDIA + Zen Kernel + Max Performance.
|
||||||
|
3. **Eco-Battery:** NVIDIA + TLP (Max Saver).
|
||||||
|
4. **No-dGPU:** **iGPU Only**. Use this when the GPU module is physically replaced with the Expansion Shell.
|
||||||
|
|
||||||
1. **Mount Root (`@`):**
|
### Bus IDs
|
||||||
|
* **NVIDIA:** 193 (`c1:00.0`)
|
||||||
|
* **AMD:** 194 (`c2:00.0`)
|
||||||
|
|
||||||
```
|
---
|
||||||
mount -o compress=zstd,subvol=@ /dev/nvme0n1p2 /mnt
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Create Mount Points:**
|
## 6. Docker
|
||||||
|
Docker is installed in Rootless mode.
|
||||||
```
|
```bash
|
||||||
mkdir -p /mnt/{home,nix,boot}
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Mount Home (`@home`):**
|
|
||||||
|
|
||||||
```
|
|
||||||
mount -o compress=zstd,subvol=@home /dev/nvme0n1p2 /mnt/home
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Mount Nix Store (`@nix`):**
|
|
||||||
|
|
||||||
```
|
|
||||||
mount -o compress=zstd,noatime,subvol=@nix /dev/nvme0n1p2 /mnt/nix
|
|
||||||
```
|
|
||||||
|
|
||||||
5. **Mount Boot:**
|
|
||||||
|
|
||||||
```
|
|
||||||
mount /dev/nvme0n1p1 /mnt/boot
|
|
||||||
```
|
|
||||||
|
|
||||||
### C. Deploy Configuration (Git Method)
|
|
||||||
|
|
||||||
1. **Clone Your Repo:**
|
|
||||||
|
|
||||||
```
|
|
||||||
mkdir -p /mnt/etc/nixos
|
|
||||||
# Replace USERNAME with your git.nimmog.uk user
|
|
||||||
nix-shell -p git --run "git clone https://git.nimmog.uk/USERNAME/nixos-config.git /mnt/etc/nixos/"
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Generate Hardware Scan:**
|
|
||||||
This creates `hardware-configuration.nix` in the folder.
|
|
||||||
|
|
||||||
```
|
|
||||||
nixos-generate-config --root /mnt
|
|
||||||
```
|
|
||||||
|
|
||||||
*(Ignore the warning about configuration.nix existing)*
|
|
||||||
|
|
||||||
### D. Install & Set Password
|
|
||||||
|
|
||||||
1. **Run the Installer:**
|
|
||||||
|
|
||||||
```
|
|
||||||
nixos-install --flake /mnt/etc/nixos#electra
|
|
||||||
```
|
|
||||||
|
|
||||||
*If prompted to set a ROOT password, go ahead and set one.*
|
|
||||||
|
|
||||||
2. **Set USER Password (Critical):**
|
|
||||||
Do not reboot yet! We need to set the password for `nimmo`.
|
|
||||||
|
|
||||||
Enter the new system environment:
|
|
||||||
|
|
||||||
```
|
|
||||||
nixos-enter
|
|
||||||
```
|
|
||||||
|
|
||||||
Set the password:
|
|
||||||
|
|
||||||
```
|
|
||||||
passwd nimmo
|
|
||||||
```
|
|
||||||
|
|
||||||
Exit the environment:
|
|
||||||
|
|
||||||
```
|
|
||||||
exit
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Reboot:**
|
|
||||||
|
|
||||||
```
|
|
||||||
reboot
|
|
||||||
```
|
|
||||||
|
|
||||||
## 3. Bus ID Configuration (Done)
|
|
||||||
|
|
||||||
* **NVIDIA:** 193 (`c1:00.0`)
|
|
||||||
|
|
||||||
* **AMD:** 194 (`c2:00.0`)
|
|
||||||
|
|
||||||
## 4. Applying Changes (Post-Install)
|
|
||||||
|
|
||||||
**To apply updates or config changes:**
|
|
||||||
|
|
||||||
1. Edit your files in `/etc/nixos/` (or pull changes from git).
|
|
||||||
|
|
||||||
2. (Optional) Commit your changes: `git commit -am "Update config"`
|
|
||||||
|
|
||||||
3. Rebuild:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo nixos-rebuild switch --flake /etc/nixos/#electra
|
|
||||||
```
|
|
||||||
|
|
||||||
## 5. Boot Modes (Select at Boot)
|
|
||||||
|
|
||||||
You will see **four** options in your bootloader. Use arrow keys to select.
|
|
||||||
|
|
||||||
### 1. NixOS Default
|
|
||||||
|
|
||||||
* **Setup:** NVIDIA + Balanced Power (KDE).
|
|
||||||
|
|
||||||
* **Use when:** NVIDIA Module **INSERTED**.
|
|
||||||
|
|
||||||
### 2. Gaming-Zen
|
|
||||||
|
|
||||||
* **Setup:** NVIDIA + Zen Kernel + Max Performance.
|
|
||||||
|
|
||||||
* **Use when:** Gaming with NVIDIA Module **INSERTED**.
|
|
||||||
|
|
||||||
### 3. Eco-Battery
|
|
||||||
|
|
||||||
* **Setup:** NVIDIA + TLP (Max Saver).
|
|
||||||
|
|
||||||
* **Use when:** Traveling with NVIDIA Module **INSERTED**.
|
|
||||||
|
|
||||||
### 4. No-dGPU (Expansion Shell)
|
|
||||||
|
|
||||||
* **Setup:** **NO NVIDIA DRIVERS**. iGPU Only.
|
|
||||||
|
|
||||||
* **Use when:** You have physically **REMOVED** the GPU module and inserted the blank Expansion Shell.
|
|
||||||
|
|
||||||
* *Note: If you boot Default with the GPU removed, the system will likely fail to reach the desktop.*
|
|
||||||
|
|
||||||
## 6. Adding New Apps
|
|
||||||
|
|
||||||
* **CLI Tools:** Edit `system-utils.nix`.
|
|
||||||
|
|
||||||
* **GUI Apps:** Edit `user-apps.nix`.
|
|
||||||
|
|
||||||
* **After editing:** Run the rebuild command in step 4.
|
|
||||||
|
|
||||||
## 7. Docker
|
|
||||||
|
|
||||||
Docker is installed and running in Rootless mode. You can run docker commands immediately as user `nimmo`:
|
|
||||||
|
|
||||||
```
|
|
||||||
docker run hello-world
|
docker run hello-world
|
||||||
```
|
```
|
||||||
|
|
||||||
## 8. Fingerprint Reader
|
## 7. Fingerprint Reader
|
||||||
|
* **Login:** Password only (required for KWallet).
|
||||||
1. Go to **System Settings -> Users** and click "Configure Fingerprint".
|
* **Sudo/Unlock:** Fingerprint enabled.
|
||||||
|
|
||||||
2. If that fails, run `fprintd-enroll` in a terminal.
|
|
||||||
|
|
||||||
3. **Usage:**
|
|
||||||
|
|
||||||
* **Login (SDDM):** Password only (required to unlock KWallet).
|
|
||||||
|
|
||||||
* **Unlock Screen:** Fingerprint or Password.
|
|
||||||
|
|
||||||
* **Sudo (Terminal):** Fingerprint or Password.
|
|
||||||
|
|
|
||||||
120
common/default.nix
Normal file
120
common/default.nix
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[
|
||||||
|
./system-utils.nix # CLI Tools
|
||||||
|
./user-apps.nix # GUI Apps
|
||||||
|
];
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 1. CORE SYSTEM SETTINGS
|
||||||
|
# ==========================================
|
||||||
|
# Bootloader (Standard UEFI)
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
|
# Networking
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
# Time & Locale
|
||||||
|
time.timeZone = "Europe/London";
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 2. USER ACCOUNT
|
||||||
|
# ==========================================
|
||||||
|
users.users.nimmo = {
|
||||||
|
isNormalUser = true;
|
||||||
|
description = "Nimmo";
|
||||||
|
extraGroups = [ "networkmanager" "wheel" "docker" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 3. COMMON SERVICES
|
||||||
|
# ==========================================
|
||||||
|
# Firmware & Updates
|
||||||
|
services.fwupd.enable = true;
|
||||||
|
|
||||||
|
# Power (Standard Profile)
|
||||||
|
services.power-profiles-daemon.enable = true;
|
||||||
|
|
||||||
|
# Filesystem Maintenance
|
||||||
|
services.fstrim.enable = true;
|
||||||
|
zramSwap.enable = true;
|
||||||
|
services.btrfs.autoScrub = {
|
||||||
|
enable = true;
|
||||||
|
interval = "weekly";
|
||||||
|
fileSystems = [ "/" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Garbage Collection
|
||||||
|
nix.gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "weekly";
|
||||||
|
options = "--delete-older-than 7d";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Bluetooth
|
||||||
|
hardware.bluetooth.enable = true;
|
||||||
|
hardware.bluetooth.powerOnBoot = true;
|
||||||
|
|
||||||
|
# Audio (Pipewire)
|
||||||
|
security.rtkit.enable = true;
|
||||||
|
services.pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
alsa.support32Bit = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
virtualisation.docker.enable = true;
|
||||||
|
|
||||||
|
# Steam
|
||||||
|
programs.steam = {
|
||||||
|
enable = true;
|
||||||
|
remotePlay.openFirewall = true;
|
||||||
|
dedicatedServer.openFirewall = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 4. DESKTOP ENVIRONMENT (Plasma 6)
|
||||||
|
# ==========================================
|
||||||
|
services.xserver.enable = true;
|
||||||
|
services.displayManager.sddm.enable = true;
|
||||||
|
services.displayManager.sddm.wayland.enable = true;
|
||||||
|
services.desktopManager.plasma6.enable = true;
|
||||||
|
services.xserver.xkb.layout = "gb";
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 5. NIX CORE SETTINGS
|
||||||
|
# ==========================================
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 6. POLISHING
|
||||||
|
# ==========================================
|
||||||
|
fonts.packages = with pkgs; [
|
||||||
|
noto-fonts
|
||||||
|
noto-fonts-cjk-sans
|
||||||
|
noto-fonts-emoji
|
||||||
|
nerd-fonts.jetbrains-mono
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.nix-ld.enable = true;
|
||||||
|
programs.nix-ld.libraries = with pkgs; [
|
||||||
|
stdenv.cc.cc.lib
|
||||||
|
zlib
|
||||||
|
fuse3
|
||||||
|
icu
|
||||||
|
nss
|
||||||
|
openssl
|
||||||
|
curl
|
||||||
|
expat
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.variables.EDITOR = "nano";
|
||||||
|
}
|
||||||
|
|
@ -1,223 +0,0 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
./hardware-configuration.nix # Generated by the installer
|
|
||||||
./system-utils.nix # CLI Tools
|
|
||||||
./user-apps.nix # GUI Apps
|
|
||||||
];
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# 1. BOOT & KERNEL STRATEGY
|
|
||||||
# ==========================================
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
|
||||||
|
|
||||||
# --- KERNEL PARAMETERS (LLM/AI) ---
|
|
||||||
# Force AMD GTT to 32GB.
|
|
||||||
# Combined with 16GB BIOS VRAM, this gives ~48GB total addressable to iGPU.
|
|
||||||
boot.kernelParams = [ "amdgpu.gttsize=32768" ];
|
|
||||||
|
|
||||||
# Load AMDGPU drivers early to prevent blank boot screens on Strix Point
|
|
||||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
|
||||||
|
|
||||||
# --- DEFAULT MODE (Balanced/Daily Use) ---
|
|
||||||
# boot.kernelPackages = pkgs.linuxPackages_latest; # Use default stable kernel for better Nvidia support
|
|
||||||
|
|
||||||
# --- SPECIALISATIONS (Selectable at Boot) ---
|
|
||||||
specialisation = {
|
|
||||||
# Option 1: Gaming Mode (Zen Kernel + Max Performance)
|
|
||||||
gaming-zen.configuration = {
|
|
||||||
system.nixos.tags = [ "Gaming-Zen" ];
|
|
||||||
boot.kernelPackages = lib.mkForce pkgs.linuxPackages_zen;
|
|
||||||
hardware.nvidia.powerManagement.finegrained = lib.mkForce false;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Option 2: Eco/Battery Mode (TLP + No Turbo)
|
|
||||||
battery-saver.configuration = {
|
|
||||||
system.nixos.tags = [ "Eco-Battery" ];
|
|
||||||
services.power-profiles-daemon.enable = lib.mkForce false;
|
|
||||||
services.tlp = {
|
|
||||||
enable = lib.mkForce true;
|
|
||||||
settings = {
|
|
||||||
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
|
|
||||||
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
|
|
||||||
CPU_BOOST_ON_BAT = 0;
|
|
||||||
PLATFORM_PROFILE_ON_BAT = "low-power";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Option 3: Expansion Shell (Physically Removed GPU)
|
|
||||||
no-dgpu.configuration = {
|
|
||||||
system.nixos.tags = [ "No-dGPU" ];
|
|
||||||
|
|
||||||
# 1. Force Video Driver to standard modesetting (ignores Nvidia)
|
|
||||||
services.xserver.videoDrivers = lib.mkForce [ "modesetting" ];
|
|
||||||
|
|
||||||
# 2. Blacklist Nvidia Kernel Modules to prevent loading attempts
|
|
||||||
boot.blacklistedKernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
|
|
||||||
|
|
||||||
# 3. Disable Nvidia Hardware Options
|
|
||||||
hardware.nvidia = {
|
|
||||||
modesetting.enable = lib.mkForce false;
|
|
||||||
powerManagement.enable = lib.mkForce false;
|
|
||||||
open = lib.mkForce false;
|
|
||||||
nvidiaSettings = lib.mkForce false;
|
|
||||||
prime.offload.enable = lib.mkForce false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# 2. NETWORKING & LOCALES
|
|
||||||
# ==========================================
|
|
||||||
networking.hostName = "electra";
|
|
||||||
networking.networkmanager.enable = true;
|
|
||||||
|
|
||||||
time.timeZone = "Europe/London";
|
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# 3. USER ACCOUNT (nimmo)
|
|
||||||
# ==========================================
|
|
||||||
users.users.nimmo = {
|
|
||||||
isNormalUser = true;
|
|
||||||
description = "Nimmo";
|
|
||||||
# "docker" group allows running containers without sudo
|
|
||||||
extraGroups = [ "networkmanager" "wheel" "docker" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# 4. HARDWARE & SERVICES
|
|
||||||
# ==========================================
|
|
||||||
# Framework 16 Fingerprint Reader
|
|
||||||
services.fprintd.enable = true;
|
|
||||||
|
|
||||||
# Connect Fingerprint to Auth Systems
|
|
||||||
security.pam.services.sudo.fprintAuth = true;
|
|
||||||
security.pam.services.kde.fprintAuth = true; # Lock Screen
|
|
||||||
security.pam.services.sddm.fprintAuth = false; # Disable for login (KWallet)
|
|
||||||
|
|
||||||
# Firmware & Updates
|
|
||||||
services.fwupd.enable = true;
|
|
||||||
hardware.enableAllFirmware = true;
|
|
||||||
hardware.cpu.amd.updateMicrocode = true;
|
|
||||||
|
|
||||||
# Power Management (Standard: KDE Integration)
|
|
||||||
services.power-profiles-daemon.enable = true;
|
|
||||||
|
|
||||||
# SSD & Filesystem Maintenance
|
|
||||||
services.fstrim.enable = true;
|
|
||||||
zramSwap.enable = true;
|
|
||||||
services.btrfs.autoScrub = {
|
|
||||||
enable = true;
|
|
||||||
interval = "weekly";
|
|
||||||
fileSystems = [ "/" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Automatic Garbage Collection
|
|
||||||
nix.gc = {
|
|
||||||
automatic = true;
|
|
||||||
dates = "weekly";
|
|
||||||
options = "--delete-older-than 7d";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Bluetooth
|
|
||||||
hardware.bluetooth.enable = true;
|
|
||||||
hardware.bluetooth.powerOnBoot = true;
|
|
||||||
|
|
||||||
# Audio (Pipewire)
|
|
||||||
security.rtkit.enable = true;
|
|
||||||
services.pipewire = {
|
|
||||||
enable = true;
|
|
||||||
alsa.enable = true;
|
|
||||||
alsa.support32Bit = true;
|
|
||||||
pulse.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Docker Support
|
|
||||||
virtualisation.docker.enable = true;
|
|
||||||
|
|
||||||
# Steam (Ports & 32-bit dependencies)
|
|
||||||
programs.steam = {
|
|
||||||
enable = true;
|
|
||||||
remotePlay.openFirewall = true;
|
|
||||||
dedicatedServer.openFirewall = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# 5. DESKTOP (Plasma 6)
|
|
||||||
# ==========================================
|
|
||||||
services.xserver.enable = true;
|
|
||||||
services.displayManager.sddm.enable = true;
|
|
||||||
services.displayManager.sddm.wayland.enable = true;
|
|
||||||
services.desktopManager.plasma6.enable = true;
|
|
||||||
services.xserver.xkb.layout = "gb";
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# 6. GRAPHICS (RTX 5070 + Strix Point)
|
|
||||||
# ==========================================
|
|
||||||
hardware.graphics = {
|
|
||||||
enable = true;
|
|
||||||
enable32Bit = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
|
||||||
|
|
||||||
hardware.nvidia = {
|
|
||||||
modesetting.enable = true;
|
|
||||||
|
|
||||||
# Power Management (Default: Finegrained/Battery Friendly)
|
|
||||||
# This puts the GPU to sleep when not in use.
|
|
||||||
# Note: Overridden to 'false' in Gaming Mode specialisation above.
|
|
||||||
powerManagement.enable = true;
|
|
||||||
powerManagement.finegrained = true;
|
|
||||||
|
|
||||||
open = true;
|
|
||||||
nvidiaSettings = true;
|
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
|
||||||
|
|
||||||
prime = {
|
|
||||||
offload = {
|
|
||||||
enable = true;
|
|
||||||
enableOffloadCmd = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
amdgpuBusId = "PCI:194:0:0"; # c2:00.0 -> 194
|
|
||||||
nvidiaBusId = "PCI:193:0:0"; # c1:00.0 -> 193
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# 7. NIX CORE SETTINGS
|
|
||||||
# ==========================================
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
||||||
system.stateVersion = "24.11";
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# 8. POLISHING (Fonts & Compatibility)
|
|
||||||
# ==========================================
|
|
||||||
fonts.packages = with pkgs; [
|
|
||||||
noto-fonts
|
|
||||||
noto-fonts-cjk-sans
|
|
||||||
noto-fonts-emoji
|
|
||||||
nerd-fonts.jetbrains-mono
|
|
||||||
];
|
|
||||||
|
|
||||||
programs.nix-ld.enable = true;
|
|
||||||
programs.nix-ld.libraries = with pkgs; [
|
|
||||||
stdenv.cc.cc.lib
|
|
||||||
zlib
|
|
||||||
fuse3
|
|
||||||
icu
|
|
||||||
nss
|
|
||||||
openssl
|
|
||||||
curl
|
|
||||||
expat
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.variables.EDITOR = "nano";
|
|
||||||
}
|
|
||||||
24
flake.nix
24
flake.nix
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
description = "Nimmo's NixOS Config (Electra)";
|
description = "Nimmo's NixOS Configurations";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
# 1. Official NixOS Unstable (Required for Strix Point/RTX 5070 hardware support)
|
# 1. Official NixOS Unstable (Required for Strix Point/RTX 5070 hardware support)
|
||||||
|
|
@ -12,17 +12,29 @@
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }@inputs: {
|
outputs = { self, nixpkgs, ... }@inputs: {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
# This name "electra" must match networking.hostName in configuration.nix
|
|
||||||
|
# =======================
|
||||||
|
# 1. ELECTRA (Main Laptop)
|
||||||
|
# =======================
|
||||||
electra = nixpkgs.lib.nixosSystem {
|
electra = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
# Pass inputs to modules so user-apps.nix can access Antigravity
|
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
./configuration.nix
|
./hosts/electra/default.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# =======================
|
||||||
|
# 2. LENA (Secondary Laptop)
|
||||||
|
# =======================
|
||||||
|
lena = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
|
modules = [
|
||||||
|
./hosts/lena/default.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
98
hosts/electra/default.nix
Normal file
98
hosts/electra/default.nix
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[
|
||||||
|
../../common
|
||||||
|
./hardware-configuration.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "electra";
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 1. HARDWARE SPECIFICS (Framework 16)
|
||||||
|
# ==========================================
|
||||||
|
hardware.enableAllFirmware = true;
|
||||||
|
hardware.cpu.amd.updateMicrocode = true;
|
||||||
|
|
||||||
|
# Fingerprint Reader
|
||||||
|
services.fprintd.enable = true;
|
||||||
|
security.pam.services.sudo.fprintAuth = true;
|
||||||
|
security.pam.services.kde.fprintAuth = true;
|
||||||
|
security.pam.services.sddm.fprintAuth = false;
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 2. GRAPHICS & KERNEL (Strix Point + RTX 5070)
|
||||||
|
# ==========================================
|
||||||
|
|
||||||
|
# Kernel Params for Strix Point iGPU
|
||||||
|
boot.kernelParams = [ "amdgpu.gttsize=32768" ];
|
||||||
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
|
|
||||||
|
# Graphics Drivers
|
||||||
|
hardware.graphics = {
|
||||||
|
enable = true;
|
||||||
|
enable32Bit = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
|
||||||
|
hardware.nvidia = {
|
||||||
|
modesetting.enable = true;
|
||||||
|
powerManagement.enable = true;
|
||||||
|
powerManagement.finegrained = true;
|
||||||
|
open = true;
|
||||||
|
nvidiaSettings = true;
|
||||||
|
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||||
|
|
||||||
|
prime = {
|
||||||
|
offload = {
|
||||||
|
enable = true;
|
||||||
|
enableOffloadCmd = true;
|
||||||
|
};
|
||||||
|
amdgpuBusId = "PCI:194:0:0";
|
||||||
|
nvidiaBusId = "PCI:193:0:0";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# ==========================================
|
||||||
|
# 3. SPECIALISATIONS (Gaming / Eco / No-dGPU)
|
||||||
|
# ==========================================
|
||||||
|
specialisation = {
|
||||||
|
# Option 1: Gaming Mode (Zen Kernel + Max Performance)
|
||||||
|
gaming-zen.configuration = {
|
||||||
|
system.nixos.tags = [ "Gaming-Zen" ];
|
||||||
|
boot.kernelPackages = lib.mkForce pkgs.linuxPackages_zen;
|
||||||
|
hardware.nvidia.powerManagement.finegrained = lib.mkForce false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Option 2: Eco/Battery Mode (TLP + No Turbo)
|
||||||
|
battery-saver.configuration = {
|
||||||
|
system.nixos.tags = [ "Eco-Battery" ];
|
||||||
|
services.power-profiles-daemon.enable = lib.mkForce false;
|
||||||
|
services.tlp = {
|
||||||
|
enable = lib.mkForce true;
|
||||||
|
settings = {
|
||||||
|
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
|
||||||
|
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
|
||||||
|
CPU_BOOST_ON_BAT = 0;
|
||||||
|
PLATFORM_PROFILE_ON_BAT = "low-power";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Option 3: Expansion Shell (Physically Removed GPU)
|
||||||
|
no-dgpu.configuration = {
|
||||||
|
system.nixos.tags = [ "No-dGPU" ];
|
||||||
|
services.xserver.videoDrivers = lib.mkForce [ "modesetting" ];
|
||||||
|
boot.blacklistedKernelModules = [ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
|
||||||
|
hardware.nvidia = {
|
||||||
|
modesetting.enable = lib.mkForce false;
|
||||||
|
powerManagement.enable = lib.mkForce false;
|
||||||
|
open = lib.mkForce false;
|
||||||
|
nvidiaSettings = lib.mkForce false;
|
||||||
|
prime.offload.enable = lib.mkForce false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
15
hosts/lena/default.nix
Normal file
15
hosts/lena/default.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[
|
||||||
|
../../common
|
||||||
|
./hardware-configuration.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "lena";
|
||||||
|
|
||||||
|
# Basic hardware support (Microcode updates appropriate for Intel/AMD depending on what Lena is)
|
||||||
|
# Assuming Lena is standard, we enable firmware. Update if Lena is ancient.
|
||||||
|
hardware.enableAllFirmware = true;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue