- Nix 82.4%
- Lua 17.3%
- Shell 0.3%
| modules | ||
| pkgs | ||
| wallpapers | ||
| flake.lock | ||
| flake.nix | ||
| rapidrice.knsv | ||
| README.md | ||
NixOS Configuration
Forked from tama-gucci/.dotfiles
A modular NixOS config using the dendritic pattern — it's a fancy way of saying modules build on each other so you don't repeat yourself.
Quick Start
# Build a host config
sudo nixos-rebuild switch --flake .#desktop # Your desktop
sudo nixos-rebuild switch --flake .#laptop # Your laptop
Structure
modules/
├── meta.nix # Your name, email, defaults (fill in!)
├── nixos/ # System modules (base → pc → desktop/laptop)
├── hardware/ # GPU, secure boot, hibernation, monitors
├── interface/ # Hyprland, KDE Plasma, Noctalia shell
├── applications/ # Gaming, development, browsers
└── hosts/ # One file per machine
├── desktop.nix # AMD CPU + AMD dGPU
└── laptop.nix # Intel iGPU (swap one line for AMD)
Module Layers
base → pc → desktop (performance, no power saving)
└→ laptop (power management, lid switch)
Each layer adds to the one before:
- base — boot, security, networking
- pc — your user account, audio, bluetooth, home-manager
- desktop — performance governor, no power saving
- laptop — power management, lid switch, battery care
GPU Module: One-Line Toggle
Every CPU/GPU detail lives in the GPU module. Swap vendors by changing one line in the host file.
Which module to pick:
| Hardware | Use this | Notes |
|---|---|---|
| AMD GPU (any) | modules.amd-gpu |
amdgpu in initrd, AMD microcode |
| Intel GPU (any) | modules.intel-gpu |
i915 loads by default, Intel microcode |
Desktop
modules/hosts/desktop.nix imports modules.amd-gpu.
Laptop → one comment away from AMD
In modules/hosts/laptop.nix:
modules.intel-gpu # ← change to modules.amd-gpu for AMD laptop
The Intel module owns kvm-intel and Intel microcode; the AMD module owns kvm-amd, AMD microcode, and amdgpu initrd. No inline config to touch.
Hosts
Desktop (.#desktop)
- AMD GPU →
modules.amd-gpu - Hyprland (+ Noctalia shell) + KDE Plasma
- Gaming, development
Laptop (.#laptop)
- Intel GPU →
modules.intel-gpu - Hyprland (+ Noctalia shell) + KDE Plasma
- Power management, hibernation
Adding a New Machine
- Copy an existing host file:
cp modules/hosts/desktop.nix modules/hosts/myhost.nix
- Edit the copy:
{ config, ... }:
let
modules = config.flake.modules.nixos;
in {
configurations.nixos.myhost = {
system = "x86_64-linux";
modules = [
modules.desktop # or modules.laptop
modules.amd-gpu # pick your GPU module
# ... other modules
({ config, lib, pkgs, modulesPath, ... }: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
networking.hostName = "myhost";
# ... filesystem config
})
];
};
}
- Build:
sudo nixos-rebuild switch --flake .#myhost
Adding a Drive (Game Drive, Extra SSD, etc.)
Add a fileSystems entry in the host file's hardware block. For example, an existing ext4 game SSD:
fileSystems."/games" = {
device = "/dev/disk/by-uuid/53c5621c-9af6-4aa6-8329-57e231f159c2";
fsType = "ext4";
};
For a new drive: partition with gdisk or parted, format with mkfs.ext4 (or mkfs.btrfs), then grab the UUID with blkid and add the same block above.
Common filesystem options:
- ext4 —
"defaults"(works for game drives, media) - btrfs — add
"compress=zstd""noatime""ssd" - NTFS — needs
ntfs3gorntfsprogspackage,fsType = "ntfs3"
Hardware Specifics: UUIDs & Encryption
Each host file (hosts/*.nix) contains hardware-specific values like disk UUIDs for fileSystems, swapDevices, and boot.initrd.luks. This is standard NixOS practice — nixos-generate-config writes the same thing.
If you fork this repo, you'll need to replace the UUIDs in the host file with your disk's values.
Finding Your UUIDs
# List all disks
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT
# Get UUIDs for all partitions (run after formatting)
sudo blkid
# Get UUID for a specific partition
sudo blkid /dev/nvme0n1p2
# Output looks like:
# /dev/nvme0n1p2: UUID="abc123..." TYPE="btrfs" PARTUUID="def456..."
#
# - UUID → filesystem UUID (use in fileSystems)
# - PARTUUID → partition table UUID (use for boot)
# - For LUKS: the UUID is the LUKS header UUID, not the inner filesystem
# The host files use /dev/disk/by-uuid/<UUID> for reliability
The host files use /dev/disk/by-uuid/<UUID> (not /dev/sdX) so mounts survive disk reordering.
Fresh Install
1. Boot the NixOS live ISO
2. Partition & Format
Match the scheme from your target host file. For example (desktop — btrfs single-disk):
First identify your disk:
lsblk -o NAME,SIZE,TYPE,MODEL
# Look for your target disk (e.g. nvme0n1, sda, vda)
Then partition with gdisk:
sudo gdisk /dev/nvme0n1 # ← replace with your disk
Inside gdisk, follow these steps:
Command: o # Create new empty GPT partition table
Proceed? Y
Command: n # New partition (EFI system partition)
Partition number: 1
First sector: (press Enter for default)
Last sector: +1G
Hex code: ef00
Command: n # New partition (main filesystem)
Partition number: 2
First sector: (press Enter for default)
Last sector: (press Enter for rest of disk)
Hex code: 8300
Command: w # Write table to disk
Proceed? Y
Then format:
sudo mkfs.vfat -F 32 /dev/nvme0n1p1
sudo mkfs.btrfs -L nixos /dev/nvme0n1p2
# Create subvolumes
sudo mount /dev/nvme0n1p2 /mnt
sudo btrfs subvolume create /mnt/@
sudo btrfs subvolume create /mnt/@home
sudo btrfs subvolume create /mnt/@nix
sudo btrfs subvolume create /mnt/@persist
sudo btrfs subvolume create /mnt/@log
sudo btrfs subvolume create /mnt/@swap
sudo umount /mnt
# Mount
sudo mount -o compress=zstd,noatime,subvol=@ /dev/nvme0n1p2 /mnt
sudo mkdir -p /mnt/{boot,home,nix,persist,var/log,swap}
sudo mount -o compress=zstd,noatime,subvol=@home /dev/nvme0n1p2 /mnt/home
sudo mount -o compress=zstd,noatime,subvol=@nix /dev/nvme0n1p2 /mnt/nix
sudo mount -o compress=zstd,noatime,subvol=@persist /dev/nvme0n1p2 /mnt/persist
sudo mount -o compress=zstd,noatime,subvol=@log /dev/nvme0n1p2 /mnt/var/log
sudo mount -o subvol=@swap /dev/nvme0n1p2 /mnt/swap
sudo mount /dev/nvme0n1p1 /mnt/boot
3. Generate Minimal Config
sudo nixos-generate-config --root /mnt
This writes /mnt/etc/nixos/hardware-configuration.nix with your disk UUIDs. Read it:
cat /mnt/etc/nixos/hardware-configuration.nix
Copy each by-uuid/<UUID> into your host file. On minimal ISO, open both files in nano and copy between them:
# Step 4 first: clone the repo
git clone https://git.fuge.dev/Fuge/dotfiles /mnt/home/rapid/dotfiles
# Open both files in nano (switch with Alt+, / Alt+.)
sudo nano /mnt/etc/nixos/hardware-configuration.nix \
/mnt/home/rapid/dotfiles/modules/hosts/desktop.nix
In nano: Alt+, / Alt+. to switch files, Ctrl+6 to start selection, Alt+6 to copy, Ctrl+U to paste.
4. Clone & Configure
git clone https://git.fuge.dev/Fuge/dotfiles /mnt/home/rapid/dotfiles
# Edit modules/meta.nix — set your username, name, email, timezone
# Edit the host file — replace UUIDs with yours from step 3
5. Install
sudo nixos-install --flake /mnt/home/rapid/dotfiles#desktop
nixos-install will ask for a root password at the end — set it (you'll only use it for recovery). After it finishes:
sudo umount -R /mnt
sudo reboot
Pull the live ISO USB when it restarts.
6. First Boot
Log in as your user with password changeme (set in pc.nix). Change it immediately:
passwd
Secure Boot (Lanzaboote)
Disabled by default because it needs hardware setup. To enable:
# On the installed system (after first boot):
sudo sbctl create-keys
sudo sbctl enroll-keys --microsoft # keeps Windows bootability
Then uncomment modules.secureboot in your host file and rebuild:
sudo nixos-rebuild switch --flake .#desktop
Lanzaboote signs your kernel and initrd with your own keys so the firmware
accepts them. sbctl manages the key enrollment.
Disk Encryption (LUKS)
If using LUKS (uncomment the boot.initrd.luks lines in the host file):
# During partitioning, create an encrypted partition instead:
sudo cryptsetup luksFormat /dev/nvme1n1p2
sudo cryptsetup open /dev/nvme1n1p2 nixos
# Then format the opened container as btrfs
sudo mkfs.btrfs -L nixos /dev/mapper/nixos
The UUID in boot.initrd.luks.devices is the LUKS header UUID (sudo blkid /dev/nvme1n1p2), not the filesystem UUID.
Hibernation (Swapfile)
When setting up hibernation, you need the swapfile offset for the resume kernel parameter:
# filefrag is in e2fsprogs
nix-shell -p e2fsprogs
sudo filefrag -v /swap/swapfile | awk '/^[[:space:]]*0:/ {print $4}'
Set the output as hibernation.offset in the host file, then rebuild.
Centralized Settings
modules/meta.nix has your name, shell, editor, timezone — change once, applies everywhere.
Credits
- tama-gucci/.dotfiles
- mightyiam/dendritic — Dendritic pattern for composable NixOS modules
- flake-parts — Flake module infrastructure
- import-tree — Auto-importing directory trees