init: NixOS flake config with home-manager and Vietnamese input
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
# 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
|
||||
|
||||
```bash
|
||||
nix-shell -p git --command "bash"
|
||||
# or just proceed if git is already available
|
||||
```
|
||||
|
||||
### 3. Clone this repo
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
cp /etc/nixos/hardware-configuration.nix ~/nixos-config/hosts/nixos/hardware-configuration.nix
|
||||
```
|
||||
|
||||
### 5. Apply the configuration
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake ~/nixos-config#nixos
|
||||
```
|
||||
|
||||
### 6. Lock the flake inputs
|
||||
|
||||
```bash
|
||||
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:
|
||||
1. Go to **System Settings → Input Devices → Virtual Keyboard**
|
||||
2. Select **Fcitx 5** and apply
|
||||
3. In the system tray, right-click the fcitx5 icon → **Configure**
|
||||
4. Add **Unikey** as an input method
|
||||
5. Switch between English/Vietnamese with **Super+Space**
|
||||
|
||||
Unikey supports both **Telex** (default) and **VNI** — configure in the Unikey settings.
|
||||
Reference in New Issue
Block a user