feat: overhaul config — noctalia shell, niri keybinds, battery, extra packages

- niri: switch from replaceStrings patching to plain config.kdl for simplicity
- niri: add Mod+Shift+Q (close), Mod+Shift+HJKL/Arrow (move window),
  Mod+Shift+1-9 (move to workspace)
- niri: add layer-rule to disable background-blur on noctalia bar (fix seam)
- noctalia: add capsule_group for cpu+ram (group:sysmon), panel_overlap,
  contact_shadow; corner_radius_scale 1.0
- noctalia: add all LC_* locale overrides in plasma-localerc (fix vi_VN calendar)
- system: TLP (battery), UPower, disable power-profiles-daemon (conflicts with TLP)
- system: DDC/CI support (ddcutil + i2c-dev + hardware.i2c)
- system: enable fish shell system-wide
- packages: add tree, fish, ddcutil; noctalia required services documented
- README: full rewrite with current structure, keybinds, fresh-install steps
This commit is contained in:
2026-08-14 03:13:46 +07:00
parent 7f19e2afaa
commit 59624cad0a
8 changed files with 894 additions and 148 deletions
+128 -51
View File
@@ -1,102 +1,179 @@
# nixos-config
Personal NixOS configuration using flakes and home-manager.
Personal NixOS configuration using flakes + home-manager.
## Structure
```
nixos-config/
├── flake.nix # Entry point — inputs and outputs
├── flake.nix # Inputs and outputs
├── flake.lock # Pinned input versions
├── hosts/
│ └── nixos/
│ ├── configuration.nix # System configuration
│ └── hardware-configuration.nix # Auto-generated, machine-specific
│ ├── configuration.nix # System-level config (kernel, services, users)
│ └── hardware-configuration.nix # Auto-generated, machine-specific (not in git)
└── home/
── duynguyen/
└── default.nix # Home-manager config (user packages, dotfiles)
── hosts/
└── nixos.nix # Home-manager entry point for this machine
└── modules/ # Reusable modules, imported by hosts/nixos.nix
├── niri/
│ ├── default.nix # Niri module (loads config.kdl + sub-modules)
│ ├── config.kdl # Niri compositor config (edit this directly)
│ ├── noctalia/
│ │ ├── default.nix # Noctalia shell settings
│ │ └── wallpapers/ # Wallpaper images (add your own here)
│ └── polkit/
│ └── default.nix # Polkit authentication agent (systemd service)
├── kitty/
│ └── default.nix # Kitty terminal settings
├── cli/
│ └── default.nix # Shell, git, starship, zoxide, fish
└── applications/
└── default.nix # All user packages, KDE/Plasma settings
```
> `home/hosts/` and `hosts/` are two different layers:
> - `hosts/` = NixOS system config (runs as root)
> - `home/hosts/` = home-manager user config (runs as your user)
>
> When adding a second machine, add one file to each.
## What's configured
- **KDE Plasma 6** on Wayland via SDDM, Breeze Dark theme
- **Niri** scrollable-tiling compositor (available as a separate session at SDDM)
- **Vietnamese input** via fcitx5 + unikey (Telex/VNI)
- Open `fcitx5-configtool` → Input Method tab → add **Unikey**
- **Touchpad**: natural scroll, acceleration 0.4, scroll factor 0.75
- **Shell**: zsh (default) with autosuggestions, syntax highlighting, starship prompt, zoxide
- **Locale**: English UI, Vietnamese formats (currency, time, etc.), Asia/Ho_Chi_Minh timezone
- **Pipewire** for audio
- **Packages**:
- Browsers: firefox, zen-browser, claude-desktop
- Terminals: kitty, foot
- Editor: vscodium
- Niri tools: fuzzel, waybar, mako, wl-clipboard
- Daily apps: mpv, imv, grim + slurp, libreoffice, telegram-desktop
- CLI: btop, ripgrep, fzf, eza, bat, gh
- System: claude-code, git, kate
### Desktop
- **Niri** scrollable-tiling Wayland compositor
- **Noctalia shell** — bar, launcher, lock screen, wallpaper, idle, notifications (replaces waybar / walker / swaylock / swaybg / mako)
- **KDE Plasma 6** via SDDM — available as a secondary session, Breeze Dark theme
- **XWayland satellite** for X11 app compatibility under Niri
- **Polkit** via `polkit-kde-agent-1`
### System
- **Locale**: English UI (`en_US.UTF-8`) everywhere, timezone `Asia/Ho_Chi_Minh`
- **Vietnamese input**: fcitx5 + unikey (Telex/VNI), toggle with `Super+Space`
- **Audio**: Pipewire (ALSA + PulseAudio compat)
- **Bluetooth**: enabled + Blueman applet
- **Power**: TLP (automatic power management), UPower (battery status)
- **Display**: DDC/CI support for external monitor brightness (`ddcutil`)
- **Fonts**: JetBrainsMono Nerd Font, Noto Color Emoji, Font Awesome
### Shell
- **zsh** (default login shell) — autosuggestions, syntax highlighting, starship prompt, zoxide
- **fish** — available as secondary shell (`fish` to launch)
### Packages (selection)
| Category | Packages |
|---|---|
| Browsers | firefox, zen-browser |
| AI | claude-desktop, claude-code |
| Terminals | kitty, ghostty, foot |
| Editor | vscodium |
| File manager | thunar + archive plugin + tumbler thumbnails |
| Media | mpv, imv, obs-studio, gimp, kdenlive |
| Office | libreoffice, zathura |
| Chat | telegram-desktop |
| CLI tools | tree, btop, htop, ripgrep, fd, fzf, eza, bat, dust, ncdu, lazygit, delta, yazi, tldr, tokei, jq, yq |
| System | brightnessctl, playerctl, ddcutil, grim, slurp, swappy, pavucontrol, blueman |
## Niri keybindings
| Key | Action |
|---|---|
| `Mod+T` | Open kitty terminal |
| `Mod+Space` | Noctalia launcher |
| `Mod+S` | Noctalia control center |
| `Super+Alt+L` | Lock screen |
| `Mod+Shift+Q` | Close window |
| `Mod+H/L` or `←/→` | Focus column left/right |
| `Mod+J/K` or `↓/↑` | Focus window down/up |
| `Mod+Shift+H/L` or `Shift+←/→` | Move column left/right |
| `Mod+Shift+J/K` or `Shift+↓/↑` | Move window down/up |
| `Mod+1-9` | Switch to workspace |
| `Mod+Shift+1-9` | Move window to workspace |
| `Mod+Shift+E` | Quit niri |
> Edit keybindings directly in `home/modules/niri/config.kdl`.
## Reproducing on a fresh machine
### 1. Install NixOS
Boot the NixOS ISO, partition, and install as normal. During install, choose KDE Plasma if prompted.
Boot the NixOS ISO and install as usual. During partitioning, set up your disks. Choose any desktop — it will be replaced.
### 2. Enable flakes temporarily
```bash
nix-shell -p git --command "bash"
# or just proceed if git is already available
```
### 3. Clone this repo
### 2. Clone this repo
```bash
nix-shell -p git
git clone <repo-url> ~/nixos-config
cd ~/nixos-config
```
### 4. Provide the hardware config
### 3. Copy your hardware config
`hardware-configuration.nix` is machine-specific and not tracked in git. Copy the one generated by the NixOS installer:
`hardware-configuration.nix` is machine-specific and not tracked in git. Copy the one the installer generated:
```bash
cp /etc/nixos/hardware-configuration.nix ~/nixos-config/hosts/nixos/hardware-configuration.nix
```
### 4. Review `hosts/nixos/configuration.nix`
Check these fields match your machine:
- `networking.hostName` — change if you want a different hostname
- `users.users.duynguyen` — change username if needed (update `home/hosts/nixos.nix` to match)
- `time.timeZone` — currently `Asia/Ho_Chi_Minh`
### 5. Apply the configuration
```bash
sudo nixos-rebuild switch --flake ~/nixos-config#nixos
```
### 6. Lock the flake inputs
This builds and activates the full system + home-manager config in one step.
```bash
nix flake update
```
### 6. Log out and back in
Commit the resulting `flake.lock` so future rebuilds use the exact same package versions.
Required so that:
- New locale settings (`LC_*`) take effect
- Niri session appears in SDDM
- Home-manager environment variables are loaded
At the SDDM login screen, select **Niri** from the session menu.
### 7. Vietnamese input (first time only)
After logging in:
1. Open `fcitx5-configtool`
2. **Input Method** tab → add **Unikey**
3. Toggle EN/VI with `Super+Space`
---
## Daily usage
| Task | Command |
|------|---------|
| Apply system + home changes | `sudo nixos-rebuild switch --flake ~/nixos-config#nixos` |
| Update all inputs | `nix flake update` |
|---|---|
| Apply changes | `sudo nixos-rebuild switch --flake ~/nixos-config#nixos` |
| Update all flake inputs | `nix flake update` |
| Update one input | `nix flake update noctalia` |
| Roll back last switch | `sudo nixos-rebuild switch --rollback` |
| Search packages | `nix search nixpkgs <name>` |
| Check what changed | `git diff` |
## Adding packages
## How to modify things
- **System-wide** (available to all users): `hosts/nixos/configuration.nix``environment.systemPackages`
- **User-level** (home-manager managed): `home/duynguyen/default.nix` `home.packages`
- **Per-user via NixOS**: `hosts/nixos/configuration.nix``users.users.duynguyen.packages`
### Add a package
Open `home/modules/applications/default.nix` and add to `home.packages`.
## Vietnamese input setup (fcitx5)
### Change niri settings
Edit `home/modules/niri/config.kdl` directly. Niri reloads the config automatically when the file changes after a rebuild.
After first build:
1. Open **fcitx5-configtool**
2. Go to the **Input Method** tab → add **Unikey**
3. Switch between English/Vietnamese with **Super+Space**
### Change noctalia bar / theme / idle
Edit `home/modules/niri/noctalia/default.nix`.
Unikey supports both **Telex** (default) and **VNI** — configure in the Unikey settings.
### Add a wallpaper
Drop an image into `home/modules/niri/noctalia/wallpapers/` and commit it.
### Add a new machine
1. `hosts/<name>/configuration.nix` + `hardware-configuration.nix`
2. `home/hosts/<name>.nix` — import the modules you want
3. Add a new `nixosConfigurations.<name>` entry in `flake.nix`