245 lines
6.2 KiB
Markdown
245 lines
6.2 KiB
Markdown
# NixOS Configuration with Hyprland
|
|
|
|
A fully declarative NixOS configuration featuring Hyprland as the Wayland compositor with extensive ricing capabilities.
|
|
|
|
## 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
|
|
|
|
## Quick Start (Fresh Install)
|
|
|
|
On a fresh NixOS installation, run:
|
|
|
|
```bash
|
|
nix-shell -p git --run "bash <(curl -s https://git.cribdev.com/raw/your-username/nixos-config/main/bootstrap.sh)"
|
|
```
|
|
|
|
Or manually:
|
|
|
|
```bash
|
|
# Install git
|
|
nix-shell -p git
|
|
|
|
# Clone this repository
|
|
git clone https://git.cribdev.com/your-username/nixos-config ~/.config/nixos
|
|
|
|
# Copy hardware configuration
|
|
sudo cp /etc/nixos/hardware-configuration.nix ~/.config/nixos/
|
|
|
|
# Edit configuration files (see below)
|
|
cd ~/.config/nixos
|
|
|
|
# Build and apply
|
|
sudo nixos-rebuild switch --flake .#myhost
|
|
```
|
|
|
|
## Configuration 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
|
|
├── modules/
|
|
│ ├── system.nix # System packages and services
|
|
│ └── hyprland.nix # Hyprland-specific configuration
|
|
└── home/
|
|
├── home.nix # Home Manager user configuration
|
|
├── hyprland.nix # Hyprland user settings and keybindings
|
|
└── waybar.nix # Waybar status bar configuration
|
|
```
|
|
|
|
## Before First Build
|
|
|
|
Edit these files with your information:
|
|
|
|
### 1. `flake.nix`
|
|
- Replace `myhost` with your hostname
|
|
- Replace `yourusername` with your username
|
|
|
|
### 2. `configuration.nix`
|
|
- Set your `networking.hostName`
|
|
- Set your `time.timeZone`
|
|
- Adjust locale settings if needed
|
|
- Update username in `users.users.yourusername`
|
|
|
|
### 3. `home/home.nix`
|
|
- Update `home.username` and `home.homeDirectory`
|
|
- Configure Git with your name and email
|
|
- Adjust package list to your needs
|
|
|
|
### 4. `home/hyprland.nix`
|
|
- Configure monitor settings
|
|
- Customize keybindings
|
|
- Adjust animations and appearance
|
|
|
|
## 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...
|
|
|
|
## 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
|
|
|
|
### Window Management
|
|
- `SUPER + Arrow Keys` - Move focus
|
|
- `SUPER + 1-9` - Switch to 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`
|
|
|
|
## Updating the System
|
|
|
|
```bash
|
|
# Update flake inputs
|
|
nix flake update
|
|
|
|
# Rebuild with new configuration
|
|
sudo nixos-rebuild switch --flake ~/.config/nixos#myhost
|
|
|
|
# Or use the 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
|
|
|
|
### Waybar not appearing
|
|
- Restart Waybar: `killall waybar && waybar &`
|
|
- Check logs: `journalctl --user -u waybar`
|
|
|
|
### No audio
|
|
- Check PipeWire status: `systemctl --user status pipewire`
|
|
- Verify audio device: `wpctl status`
|
|
|
|
### Monitor configuration
|
|
Edit `home/hyprland.nix` and adjust the `monitor` setting:
|
|
```nix
|
|
monitor = "DP-1,1920x1080@144,0x0,1";
|
|
```
|
|
|
|
## Useful Commands
|
|
|
|
```bash
|
|
# Check Hyprland version
|
|
hyprctl version
|
|
|
|
# List all windows
|
|
hyprctl clients
|
|
|
|
# Reload Hyprland config
|
|
hyprctl reload
|
|
|
|
# View Hyprland logs
|
|
cat /tmp/hypr/$(ls -t /tmp/hypr/ | head -n 1)/hyprland.log
|
|
```
|
|
|
|
## 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/)
|
|
|
|
## License
|
|
|
|
Feel free to use and modify this configuration for your own needs.
|