first commit

This commit is contained in:
Nimmo 2026-01-24 23:07:01 +00:00
commit bea3c1dce7
5 changed files with 601 additions and 0 deletions

290
README.md Normal file
View file

@ -0,0 +1,290 @@
# Nimmo's NixOS Setup Guide (Host: electra)
## 0. Pre-Installation Preparation (Do this NOW on CachyOS)
Since you are hosting this on `git.nimmog.uk`, we will create the config locally and push it before booting the installer.
1. **Create the Repository on your Server:**
* Log into `https://git.nimmog.uk`.
* Create a new **empty** repository named `nixos-config`.
* *Do not initialize with README or license (keep it empty).*
2. **Create Files Locally:**
Open a terminal in CachyOS:
```
mkdir ~/nixos-config
cd ~/nixos-config
# Run the creation script provided by Gemini to generate files here
```
3. **Initialize & Push:**
```
git init
git branch -M main
git add .
git commit -m "Initial commit: Setup for electra"
# Replace with your actual SSH or HTTPS URL
git remote add origin https://git.nimmog.uk/YOUR_USERNAME/nixos-config.git
git push -u origin main
```
## 1. Initial BIOS Setup (Crucial)
Before booting NixOS, you must configure the BIOS to handle the memory split for your LLMs.
1. Reboot and enter BIOS (usually F2 or Del).
2. Find **Graphics Memory**, **UMA Frame Buffer**, or **iGPU Memory**.
3. Set this to **16G** (or "Game Optimized" if it equates to high memory).
## 2. Installation
Once you have booted the **NixOS Unstable ISO**, choose your path below.
### Path A: Fresh Install (Wipe Everything)
*Use this if you want to start completely fresh.*
1. **Partition:** `cfdisk /dev/nvme0n1` (Delete all, Create 4G Boot + Remaining Root).
2. **Format:**
```
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
mkfs.btrfs -L nixos /dev/nvme0n1p2
```
3. **Create Subvolumes:**
```
mount /dev/nvme0n1p2 /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@nix
umount /mnt
```
4. **Proceed to Step "Mounting" below.**
### Path B: Migration (Keep /home data)
*Use this to delete CachyOS but KEEP your existing data in `@home`.*
1. **Mount the Top-Level Partition:**
```
mount /dev/nvme0n1p2 /mnt
```
2. **List & Cleanup:**
Run `ls -a /mnt`.
**Delete the OLD Operating System:**
*Warning: Be extremely careful. Do NOT delete `@home`.*
```
# 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:**
```
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@nix
```
*(Note: Ensure your existing home data is in a subvolume named `@home`.)*
4. **Format Boot Partition:**
```
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
```
5. **Unmount:**
```
umount /mnt
```
### Mounting (Common for Both Paths)
1. **Mount Root (`@`):**
```
mount -o compress=zstd,subvol=@ /dev/nvme0n1p2 /mnt
```
2. **Create Mount Points:**
```
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
```
## 8. Fingerprint Reader
1. Go to **System Settings -> Users** and click "Configure Fingerprint".
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.

222
configuration.nix Normal file
View file

@ -0,0 +1,222 @@
{ 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;
# --- 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;
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 = "us";
# ==========================================
# 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";
}

28
flake.nix Normal file
View file

@ -0,0 +1,28 @@
{
description = "Nimmo's NixOS Config (Electra)";
inputs = {
# 1. Official NixOS Unstable (Required for Strix Point/RTX 5070 hardware support)
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# 2. Antigravity (Google) - Custom Flake
antigravity.url = "github:jacopone/antigravity-nix";
antigravity.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, ... }@inputs: {
nixosConfigurations = {
# This name "electra" must match networking.hostName in configuration.nix
electra = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
# Pass inputs to modules so user-apps.nix can access Antigravity
specialArgs = { inherit inputs; };
modules = [
./configuration.nix
];
};
};
};
}

28
system-utils.nix Normal file
View file

@ -0,0 +1,28 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
# Core Tools
git
wget
curl
nano
unzip
unrar
# Monitoring & Hardware
fastfetch
htop
btop
smartmontools
pciutils # contains lspci
lshw # Hardware lister
# GPU Tools
amdgpu_top
nvtopPackages.nvidia
# Docker
docker-compose
];
}

33
user-apps.nix Normal file
View file

@ -0,0 +1,33 @@
{ pkgs, inputs, ... }:
{
users.users.nimmo.packages = with pkgs; [
# Internet & Communication
firefox
bitwarden
nextcloud-client
kdePackages.kdeconnect
# Media
haruna
gwenview
# Productivity / Office
kdePackages.kate
kdePackages.kcalc
trilium-desktop
remmina # RDP Client
# Tools & Utilities
kdePackages.spectacle
kdePackages.ark
kdePackages.filelight
meld
# Gaming (Steam handled in main config, this is extra tools)
protonup-qt
# Custom Flake Packages
inputs.antigravity.packages.${pkgs.system}.default
];
}