2.7 KiB
2.7 KiB
nixos-config
Personal NixOS configuration using flakes and home-manager.
Structure
nixos-config/
├── flake.nix # Entry point — inputs and outputs
├── hosts/
│ └── nixos/
│ ├── configuration.nix # System configuration
│ └── hardware-configuration.nix # Auto-generated, machine-specific
└── home/
└── duynguyen/
└── default.nix # Home-manager config (user packages, dotfiles)
What's configured
- KDE Plasma 6 on Wayland via SDDM
- Vietnamese input via fcitx5 + unikey (Telex/VNI)
- After switching, go to System Settings → Virtual Keyboard → select "Fcitx 5"
- Locale: English UI, Vietnamese formats (currency, time, etc.), Asia/Ho_Chi_Minh timezone
- Pipewire for audio
- Packages: firefox, kate, claude-code, git
Reproducing on a fresh machine
1. Install NixOS
Boot the NixOS ISO, partition, and install as normal. During install, choose KDE Plasma if prompted.
2. Enable flakes temporarily
nix-shell -p git --command "bash"
# or just proceed if git is already available
3. Clone this repo
git clone <repo-url> ~/nixos-config
cd ~/nixos-config
4. Replace the hardware config
The hardware-configuration.nix inside hosts/nixos/ is machine-specific. Replace it with your own:
cp /etc/nixos/hardware-configuration.nix ~/nixos-config/hosts/nixos/hardware-configuration.nix
5. Apply the configuration
sudo nixos-rebuild switch --flake ~/nixos-config#nixos
6. Lock the flake inputs
nix flake update
Commit the resulting flake.lock so future rebuilds use the exact same package versions.
Daily usage
| Task | Command |
|---|---|
| Apply system + home changes | sudo nixos-rebuild switch --flake ~/nixos-config#nixos |
| Update all inputs | nix flake update |
| Roll back last switch | sudo nixos-rebuild switch --rollback |
| Search packages | nix search nixpkgs <name> |
Adding packages
- 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
Vietnamese input setup (fcitx5)
After first build:
- Go to System Settings → Input Devices → Virtual Keyboard
- Select Fcitx 5 and apply
- In the system tray, right-click the fcitx5 icon → Configure
- Add Unikey as an input method
- Switch between English/Vietnamese with Super+Space
Unikey supports both Telex (default) and VNI — configure in the Unikey settings.