Updated README.md

This commit is contained in:
2025-11-19 21:09:37 +01:00
parent 53def74fc5
commit 015f7a46f5

333
README.md
View File

@@ -1,166 +1,183 @@
# NixOS Configuration with Hyprland
# NixOS Configuration with Hyprland - UPDATED & FIXED
A fully declarative NixOS configuration featuring Hyprland as the Wayland compositor with extensive ricing capabilities.
## What's Different in This Version
This is an **updated version** with all the fixes for compatibility with NixOS 25.05 and newer:
### Fixed Issues:
- ✅ Updated `hardware.opengl``hardware.graphics`
- ✅ Removed deprecated `sound.enable`
- ✅ Fixed `hardware.pulseaudio``services.pulseaudio`
- ✅ Updated font packages: `nerdfonts``nerd-fonts.*`
- ✅ Updated font names: `noto-fonts-cjk``noto-fonts-cjk-sans`
- ✅ Fixed package names: `thunar``xfce.thunar`
- ✅ Fixed Qt packages: `qt5ct``libsForQt5.qt5ct`, `qt6ct``kdePackages.qt6ct`
- ✅ Updated Git config API: `userName/userEmail``settings.user.name/email`
- ✅ Updated Kitty API: `theme``themeFile`
- ✅ Removed duplicate XDG portal configuration (handled by Hyprland module)
- ✅ Configured for both UEFI and BIOS/Legacy boot
## Features
- **Hyprland**: Modern Wayland compositor with beautiful animations
- **Home Manager**: User-level package and dotfile management
- **Flakes**: Reproducible, declarative configuration
- **Full Wayland Support**: Native Wayland applications and XWayland compatibility
- **Ricing Tools**: Waybar, Hyprpaper, Dunst, and more for customization
- **Development Ready**: Includes essential development tools
- **NixOS** with Flakes enabled for reproducible builds
- **Hyprland** - Modern Wayland compositor with beautiful animations
- **Home Manager** - Declarative user environment management
- **Full Wayland Support** with XWayland fallback
## Quick Start (Fresh Install)
### Desktop Environment
- **Waybar** - Highly customizable status bar
- **Wofi** - Application launcher
- **Dunst** - Notification daemon
- **Hyprpaper** - Wallpaper manager
- **SWWW** - Alternative animated wallpaper daemon
On a fresh NixOS installation, run:
### Tools & Applications
- **Kitty & Alacritty** - Modern GPU-accelerated terminals
- **ZSH** with Oh-My-Zsh - Enhanced shell experience
- **Firefox** - Web browser
- **VSCode** - Code editor
- **Thunar** - File manager
- **Modern CLI tools** - ripgrep, fd, bat, eza, fzf, etc.
## Quick Start
### Method 1: Fresh NixOS Install (Two-Phase)
**Phase 1: Install Base NixOS**
1. Boot NixOS ISO
2. Partition and format disk:
```bash
nix-shell -p git --run "bash <(curl -s https://git.cribdev.com/raw/your-username/nixos-config/main/bootstrap.sh)"
# For BIOS/Legacy (like Proxmox with legacy BIOS)
parted /dev/sda -- mklabel gpt
parted /dev/sda -- mkpart primary 1MiB 2MiB
parted /dev/sda -- set 1 bios_grub on
parted /dev/sda -- mkpart primary 2MiB 512MiB
parted /dev/sda -- mkpart primary 512MiB 100%
mkfs.fat -F 32 -n boot /dev/sda2
mkfs.ext4 -L nixos /dev/sda3
mount /dev/disk/by-label/nixos /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot
```
Or manually:
3. Generate and edit config:
```bash
nixos-generate-config --root /mnt
nano /mnt/etc/nixos/configuration.nix
# Add bootloader config (see configuration.nix for example)
```
4. Install and reboot:
```bash
nixos-install
reboot
```
**Phase 2: Apply Custom Configuration**
```bash
# Install git
# After rebooting into fresh NixOS
nix-shell -p git
# Clone this repository
git clone https://git.cribdev.com/your-username/nixos-config ~/.config/nixos
# Copy hardware configuration
git clone https://git.cribdev.com/crib/nixos-config.git ~/.config/nixos
sudo cp /etc/nixos/hardware-configuration.nix ~/.config/nixos/
# Edit configuration files (see below)
cd ~/.config/nixos
# Edit hostname in flake.nix and configuration.nix
# Edit username and other settings
# Build and apply
sudo nixos-rebuild switch --flake .#myhost
sudo nixos-rebuild switch --flake .#YOUR-HOSTNAME
reboot
```
## Configuration Structure
### Method 2: Direct Install with Flake (Advanced)
From the ISO after partitioning:
```bash
nix-shell -p git
git clone https://git.cribdev.com/crib/nixos-config.git /mnt/etc/nixos
nixos-generate-config --root /mnt --show-hardware-config > /mnt/etc/nixos/hardware-configuration.nix
# Edit configs
nano /mnt/etc/nixos/flake.nix
nano /mnt/etc/nixos/configuration.nix
# Install with flake
nixos-install --flake /mnt/etc/nixos#YOUR-HOSTNAME
reboot
```
## File Structure
```
nixos-config/
├── flake.nix # Main flake configuration
├── configuration.nix # System-level configuration
├── hardware-configuration.nix # Auto-generated hardware config
├── bootstrap.sh # Bootstrap script for fresh installs
├── flake.nix # Main entry point
├── configuration.nix # System-wide settings
├── hardware-configuration.nix # Hardware-specific settings
├── modules/
│ ├── system.nix # System packages and services
│ └── hyprland.nix # Hyprland-specific configuration
│ └── hyprland.nix # Hyprland configuration
└── home/
├── home.nix # Home Manager user configuration
├── hyprland.nix # Hyprland user settings and keybindings
└── waybar.nix # Waybar status bar configuration
├── home.nix # User packages and settings
├── hyprland.nix # Hyprland user config & keybindings
└── waybar.nix # Status bar configuration
```
## Before First Build
## Configuration Checklist
Edit these files with your information:
Before first build:
### 1. `flake.nix`
- Replace `myhost` with your hostname
- Replace `yourusername` with your username
- [ ] Edit `flake.nix`: Change hostname from "myhost"
- [ ] Edit `configuration.nix`:
- Set hostname
- Choose bootloader (GRUB for BIOS or systemd-boot for UEFI)
- Set timezone
- Update username from "crib" if needed
- [ ] Edit `home/home.nix`:
- Confirm username is correct
- Set git name and email
- Customize package list
### 2. `configuration.nix`
- Set your `networking.hostName`
- Set your `time.timeZone`
- Adjust locale settings if needed
- Update username in `users.users.yourusername`
## Bootloader Configuration
### 3. `home/home.nix`
- Update `home.username` and `home.homeDirectory`
- Configure Git with your name and email
- Adjust package list to your needs
### For UEFI Systems:
```nix
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
```
### 4. `home/hyprland.nix`
- Configure monitor settings
- Customize keybindings
- Adjust animations and appearance
### For BIOS/Legacy Systems (Proxmox default):
```nix
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
```
## Included Software
### System Tools
- NetworkManager for networking
- PipeWire for audio
- Bluetooth support
- SSH server
- CUPS for printing
### Desktop Environment
- Hyprland (Wayland compositor)
- Waybar (status bar)
- Wofi (application launcher)
- Dunst (notifications)
- Hyprpaper/SWWW (wallpapers)
### Terminal & Shell
- Kitty & Alacritty terminals
- Zsh with Oh-My-Zsh
- Modern CLI tools (eza, bat, ripgrep, fd, fzf)
### Applications
- Firefox browser
- VSCode editor
- Thunar file manager
- MPV media player
- And more...
**Important:** Make sure your partitioning matches your bootloader choice!
## Hyprland Keybindings
Default modifier key: `SUPER` (Windows key)
### Basic
- `SUPER + Return` - Launch terminal (Kitty)
- `SUPER + D` - Launch application launcher (Wofi)
- `SUPER + Q` - Close active window
- `SUPER + M` - Exit Hyprland
- `SUPER + E` - Open file manager (Thunar)
- `SUPER + V` - Toggle floating mode
- `SUPER + F` - Toggle fullscreen
- `SUPER + Return` - Terminal (Kitty)
- `SUPER + D` - App launcher (Wofi)
- `SUPER + Q` - Close window
- `SUPER + E` - File manager
- `SUPER + V` - Toggle floating
- `SUPER + F` - Fullscreen
### Window Management
- `SUPER + Arrow Keys` - Move focus
- `SUPER + 1-9` - Switch to workspace
### Workspaces
- `SUPER + 1-9` - Switch workspace
- `SUPER + SHIFT + 1-9` - Move window to workspace
- `SUPER + Mouse Left` - Move window
- `SUPER + Mouse Right` - Resize window
### Screenshots
- `SUPER + SHIFT + S` - Screenshot selection to clipboard
- `Print` - Screenshot selection to ~/Pictures
### Media Keys
- Volume up/down/mute
- Brightness up/down
- All media keys supported
## Customization
### Themes and Appearance
The configuration uses the Catppuccin color scheme by default. To customize:
1. **Waybar**: Edit `home/waybar.nix` - Change colors in the `style` section
2. **Hyprland**: Edit `home/hyprland.nix` - Modify colors in `general` and `decoration` sections
3. **Terminal**: Edit `home/home.nix` - Change Kitty theme and appearance
### Wallpapers
Place your wallpapers in `~/wallpapers/`. The default wallpaper should be `~/wallpapers/default.jpg`.
To change wallpapers on the fly:
```bash
hyprctl hyprpaper wallpaper "monitor,~/wallpapers/your-wallpaper.jpg"
```
### Additional Packages
To add more packages:
**System-wide**: Edit `modules/system.nix` and add to `environment.systemPackages`
**User-level**: Edit `home/home.nix` and add to `home.packages`
- `SUPER + SHIFT + S` - Screenshot to clipboard
- `Print` - Screenshot to ~/Pictures
## Updating the System
@@ -168,77 +185,49 @@ To add more packages:
# Update flake inputs
nix flake update
# Rebuild with new configuration
sudo nixos-rebuild switch --flake ~/.config/nixos#myhost
# Rebuild
sudo nixos-rebuild switch --flake ~/.config/nixos#YOUR-HOSTNAME
# Or use the alias (after first build)
# Or use alias (after first build)
update
```
## Maintenance
### Garbage Collection
```bash
# Remove old generations older than 7 days
sudo nix-collect-garbage --delete-older-than 7d
# Clean home-manager generations
home-manager expire-generations -7d
```
### Rollback
```bash
# List generations
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
# Rollback to previous generation
sudo nixos-rebuild switch --rollback
```
## Troubleshooting
### Black screen after login
- Check if Hyprland is starting: `journalctl -xe`
- Verify graphics drivers are installed
- Check `hardware-configuration.nix` for GPU settings
### Build Errors
### Waybar not appearing
- Restart Waybar: `killall waybar && waybar &`
- Check logs: `journalctl --user -u waybar`
**"undefined variable 'X'"**
- Package name has changed in newer NixOS
- Check this fixed config for correct names
### No audio
- Check PipeWire status: `systemctl --user status pipewire`
- Verify audio device: `wpctl status`
**"wrong type for EFI System Partition"**
- Bootloader mismatch - check your partitioning and bootloader config
### Monitor configuration
Edit `home/hyprland.nix` and adjust the `monitor` setting:
```nix
monitor = "DP-1,1920x1080@144,0x0,1";
```
**"file exists" errors**
- Likely duplicate configuration
- Check for conflicting options in different files
## Useful Commands
### Performance
```bash
# Check Hyprland version
hyprctl version
**Slow first build?**
- Use Hyprland cachix: `nix-shell -p cachix --run "cachix use hyprland"`
- Allocate more RAM/CPU to VM if using Proxmox
# List all windows
hyprctl clients
## Key Differences from Original Config
# Reload Hyprland config
hyprctl reload
# View Hyprland logs
cat /tmp/hypr/$(ls -t /tmp/hypr/ | head -n 1)/hyprland.log
```
This version is specifically updated for:
- NixOS 25.05 and newer
- Proxmox VMs with legacy BIOS
- Latest package names and APIs
- Removed all deprecated options
## Resources
- [NixOS Manual](https://nixos.org/manual/nixos/stable/)
- [Home Manager Manual](https://nix-community.github.io/home-manager/)
- [Hyprland Wiki](https://wiki.hyprland.org/)
- [NixOS Wiki](https://nixos.wiki/)
- [NixOS Package Search](https://search.nixos.org/)
## License
Feel free to use and modify this configuration for your own needs.
Free to use and modify for your own needs.