chore: desktop setup

This commit is contained in:
Rasyidan Akbar F. 2025-10-27 09:34:52 +07:00
commit 7a5dab4e19
2 changed files with 9 additions and 139 deletions

View file

@ -1,132 +0,0 @@
# Desktop Setup Guide
This guide explains how to add desktop configurations to your NixOS system.
## Architecture
Desktop configuration is split into 3 layers:
### Layer 1: Base Infrastructure (`modules/nixos/*.nix`)
Hardware support that all desktops need:
- `audio.nix` - PipeWire audio stack
- `bluetooth.nix` - Bluetooth support
- `graphics.nix` - OpenGL/Vulkan acceleration
- `fonts.nix` - System fonts
### Layer 2: Desktop Environments (`modules/nixos/desktops/`)
System-level DE/WM configuration:
- `hyprland.nix` - Hyprland compositor
- `plasma.nix` - KDE Plasma 6
- `niri.nix` - Niri compositor
- `base.nix` - Shared DE settings
### Layer 3: User Configuration (`modules/home/rsydn/desktop/`)
Home Manager user-level configs:
- `base.nix` - GTK/Qt theming
- `apps/` - GUI application configs
- `wayland/` - Compositor user configs
- `themes/` - Theme configurations
## Quick Start
### 1. Update `flake.nix`
Add a new host configuration:
```nix
nixosConfigurations.my-desktop = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./modules/nixos/system.nix
./modules/nixos/hosts/desktop-dev.nix # Your host config
home-manager.nixosModules.home-manager {
home-manager.users.rsydn = import ./modules/nixos/home/desktop.nix;
}
];
};
```
### 2. Update `modules/nixos/system.nix`
Add desktop infrastructure imports:
```nix
{ lib, ... }: {
imports = [
./users.nix
./network.nix
./ssh.nix
./containerization.nix
# Add these for desktop:
./audio.nix
./bluetooth.nix
./graphics.nix
./fonts.nix
];
# ... rest of config
}
```
### 3. Customize Host Configuration
Copy and modify `modules/nixos/hosts/desktop-dev.nix`:
- Set hostname
- Choose desktop environment (import from `desktops/`)
- Add hardware-specific settings (GPU drivers, etc.)
### 4. Enable Compositor in Home Manager
Edit `modules/home/rsydn/desktop/wayland/default.nix`:
```nix
imports = [
./hyprland # Uncomment the compositor you want
# ./niri
];
```
### 5. Build and Switch
```bash
# Check configuration
nix flake check
# Build
sudo nixos-rebuild switch --flake .#my-desktop
```
## Examples
### Hyprland Development Workstation
1. Host imports `desktops/hyprland.nix`
2. Home Manager imports `desktop/wayland/hyprland`
3. Customize keybinds in `desktop/wayland/hyprland/default.nix`
### KDE Plasma Gaming Rig
1. Host imports `desktops/plasma.nix`
2. Home Manager imports `desktop/base.nix` only
3. Enable Steam in host config
4. Add gaming packages
## Ricing Guide
All customization should happen in Layer 3 (`modules/home/rsydn/desktop/`):
1. **Themes**: Add theme files in `desktop/themes/`
2. **Compositor styling**: Edit `desktop/wayland/{hyprland,niri}/`
3. **Application configs**: Edit `desktop/apps/`
4. **Keep Layer 1 & 2 minimal** - they provide functionality, not aesthetics
## Switching Desktop Environments
Simply change the import in your host config:
```nix
# Before
imports = [ ../desktops/hyprland.nix ];
# After
imports = [ ../desktops/plasma.nix ];
```
Then rebuild your system.

View file

@ -1,12 +1,10 @@
{ lib, pkgs, ... }:
let
hardwareConfigPath = builtins.toString ./.
+ "/../desktops/hardware-configuration.nix";
hardwareModule = if builtins.pathExists hardwareConfigPath then
import hardwareConfigPath
else
(_: { });
in {
hardwareConfigPath = builtins.toString ./. + "/../desktops/hardware-configuration.nix";
hardwareModule =
if builtins.pathExists hardwareConfigPath then import hardwareConfigPath else (_: { });
in
{
# Unified desktop configuration for gaming and development
# Includes both KDE Plasma and Hyprland - switch at login screen
@ -15,6 +13,10 @@ in {
# Hardware
hardwareModule
# Audio & Graphics
../audio.nix
../graphics.nix
# Desktop Environments
../desktops/plasma.nix # KDE Plasma (for gaming)
../desktops/hyprland # Hyprland (for development)