nixos-config

Personal NixOS configuration using flakes + home-manager.

Structure

nixos-config/
├── flake.nix                              # Inputs and outputs
├── flake.lock                             # Pinned input versions
├── hosts/
│   └── nixos/
│       ├── configuration.nix              # System-level config (kernel, services, users)
│       └── hardware-configuration.nix     # Auto-generated, machine-specific (not in git)
└── home/
    ├── 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

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 ghostty 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 and install as usual. During partitioning, set up your disks. Choose any desktop — it will be replaced.

2. Clone this repo

nix-shell -p git
git clone <repo-url> ~/nixos-config
cd ~/nixos-config

3. Copy your hardware config

hardware-configuration.nix is machine-specific and not tracked in git. Copy the one the installer generated:

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

sudo nixos-rebuild switch --flake ~/nixos-config#nixos

This builds and activates the full system + home-manager config in one step.

6. Log out and back in

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 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

How to modify things

Add a package

Open home/modules/applications/default.nix and add to home.packages.

Change niri settings

Edit home/modules/niri/config.kdl directly. Niri reloads the config automatically when the file changes after a rebuild.

Change noctalia bar / theme / idle

Edit home/modules/niri/noctalia/default.nix.

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
S
Description
No description provided
Readme
2.4 MiB
Languages
Nix 100%