This my personal NixOS flake configuration, for my daily driver. It uses a mix of NixOS, Home-Manager, Agenix, and Stylix to manage the system. Note it's not recommended to use this configuration as is, as it's tailored to my needs. Feels free to use it as a reference or a starting point for your own configuration.
NixOS Wayland | |
---|---|
Window Manager | Hyprland |
Terminal Emulator | Alacritty |
Bar | Waybar |
Launcher | Rofi Wayland |
Display Manager | SDDM |
Theme Manager | Stylix |
Wallpaper Manager | Swww |
Notifications | Dunst |
Lock Screen | Hyprlock |
File Manager | Nautilus |
USB Mounting | Udiskie |
Shell | Zsh + Starship |
Media Player | MPV |
Web Browser | Firefox |
Keys | Action |
---|---|
Super + C | Close focused window |
Super + F | Fullscreen focused window |
Super + P | Pseudo focused window |
Super + G | Group focused window |
Super + H | Toggle window split |
Super + Shift + F | Toggle window float |
Super + Enter | Open terminal |
Super + L | Lock screen |
Super + D | Open application launcher |
Super + B | Open wallpaper picker |
Super + N | Open network menu |
Super + W | Open windows menu |
Super + X | Open power menu |
Super + V | Open clipboard menu |
Super + Y | Open waybar layout menu |
Super + Shift + S | Open screenshot menu |
Super + S | Screenshot tool |
Super + R | Screen recorder tool |
Super + E | Eyedropper tool |
Super + O | OCR tool |
Super + [0-9] | Switch workspaces |
Super + Ctrl + β | Move to the first empty workspace |
Super + Shift + [0-9] | Move focused window to a workspace |
Super + ββββ | Move window focus |
Super + Alt + ββ Super + Alt + Mouse Wheel |
Switch workspaces to a relative workspace |
Super + RMB + Drag | Resize focus window |
Super + LMB + Drag | Move focus window |
Super + Tab | Open special workspace |
Super + = | Move focus to special workspace |
Super + + | Move special workspace focus in relative workspace |
This setup assume modern hardware with UEFI support.
Download NixOS minimal unstable ISO from here.
Create a bootable USB drive with the ISO, Ventoy is recommended.
Boot into the USB drive using UEFI mode, else the grub installation will fail near the end.
You are logged in automatically as nixos in terminal. nixos has empty password with sudo access.
Switch to root with sudo su
.
Assume /dev/nvme0n1
is the target drive, replace it with your drive, found with lsblk
.
- Create a GPT partition table.
parted /dev/nvme0n1 -- mklabel gpt
- Create boot partition. Note I personally make my boot partition larger than 512MiB works better for
NixOS config switching to avoid running out of space.parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 1024MiB parted /dev/nvme0n1 -- set 1 esp on
- Create swap partition. Depending on your RAM size, you can adjust the size. 32GB*1024 plus boot partition size =
final number.
parted /dev/nvme0n1 -- mkpart primary linux-swap 1024MiB 33792MiB
- Create root partition. The rest of the drive.
parted /dev/nvme0n1 -- mkpart primary ext4 33792MiB 100%
- Check your lovely work.
parted /dev/nvme0n1 -- print
Labels and names are important for NixOS configuration to work properly. found in hardware-configuration.nix.
-
Format boot partition.
mkfs.fat -F32 -n boot /dev/nvme0n1p1
-
Format swap partition.
mkswap -L swap /dev/nvme0n1p2 swapon /dev/nvme0n1p2
-
Format root partition.
mkfs.ext4 -L nixos /dev/nvme0n1p3
Time to install NixOS with this flake configuration.
-
Mount root partition.
mount /dev/disk/by-label/nixos /mnt
-
Mount boot partition.
mkdir -p /mnt/boot mount /dev/disk/by-label/boot /mnt/boot
-
Clone repo.
nix-env -iA nixos.git git clone https://github.com/b-ran/dots /mnt/etc/nixos
-
Do the installation.
cd /mnt/etc/nixos nixos-install --flake .#desktop
-
If everything goes well, reboot. You should be greeted with the login screen. May need to remove the USB drive.
reboot