This is a single-user, single-machine NixOS dotfiles repository.
The main idea is to keep one flake entrypoint at the repository root, place the current machine configuration under host/, keep reusable capability modules under modules/, and store shared application config assets under assets/. host/meta.nix declares machine metadata and module selections, while the resolvers turn those selections into concrete NixOS and Home Manager imports.
flake.nix: the only flake entrypoint. It readshost/meta.nix,host/system.nix, andhost/home.nix.host/: the current machine configuration directory. Users are expected to create this directory themselves.modules/nixos/system/: optional NixOS system modules and the system resolver.modules/nixos/home/: optional Home Manager modules and the home resolver.assets/config/: shared application configuration linked or imported by Home Manager modules.template/desktop/: a reference desktop template, currently built around Niri + Dank Material Shell.
The host/ directory must contain four required files:
host/meta.nix: flake-facing metadata such as hostname, platform, user identity, and module selections.host/system.nix: the NixOS baseline for the current machine.host/home.nix: the Home Manager baseline for the current user.host/hardware-configuration.nix: hardware facts generated by NixOS.
Use the files under template/desktop/ as a starting point when creating your own host/ directory. A Rust-based TUI generator may be added in the future to create or update these host files visually. For now, the workflow stays Nix-first and manually editable.
Basic modules are enabled through modules.system and modules.home in host/meta.nix.
Example:
modules = {
system = {
display = "niri";
gpu = {
devices = [ "nvidia" ];
mode = "nvidia";
};
programs = [ "steam" ];
servers = [ "dbus" "tailscale" "sunshine" "openssh" ];
virtualizations = [ "docker" "libvirt" ];
};
home = {
ai = [ "codex" ];
coding = [ "nvim" "vscode" ];
fileManager = [ "yazi" ];
programs = [ "clash-verge-rev" "chrome" "quickemu" "obs-studio" "splayer" ];
terminal = "kitty";
};
};modules/nixos/system/resolve.nix reads modules.system and imports modules/nixos/system/<group>/<name>.nix.
modules/nixos/home/resolve.nix reads modules.home and imports modules/nixos/home/<group>/<name>.nix. A few mappings are intentionally derived:
home.fileManagermaps tomodules/nixos/home/file-manager/- the home display module follows
modules.system.display - the home shell module follows
user.shell
This repository uses both stable nixpkgs and nixpkgs-unstable.
pkgs: the default package set from the primarynixpkgsinput. System services, core system capabilities, and most modules should use this package set.pkgsUnstable: a separate package set for a small number of fast-moving home-side leaf packages, such as CLI or GUI tools.
System services and core system capabilities should not be moved to unstable by default. For example, the codex home module can use pkgsUnstable without changing the package set used by system modules.
sudo nixos-rebuild switch --flake "path:$PWD#<hostName>"Builds and switches the NixOS system configuration exported as nixosConfigurations.desktop.
Home Manager is integrated into the NixOS configuration, so this command also switches the user Home Manager configuration from host/home.nix.
home-manager switch --flake "path:$PWD#<userName>@<hostName>"Builds and switches the standalone Home Manager configuration exported as homeConfigurations.<userName>@<hostName>.
This output is kept as a fallback or debugging entrypoint; the normal workflow is nixos-rebuild switch.
nix flake update nixpkgs-unstableUpdates only the nixpkgs-unstable input in flake.lock, leaving the primary stable nixpkgs input unchanged.
<hostName> comes from hostConfig.hostName in host/meta.nix. <userName>@<hostName> comes from user.name and hostName.
Tips: if fetch go tools timeouted, try export GOPROXY=https://goproxy.cn,direct
template/desktop/ is a desktop configuration template for a Niri + Dank Material Shell Wayland setup. It is not active by itself; copy or adapt it when creating host/.
| Area | Selection |
|---|---|
| Display / compositor | Niri |
| Shell / desktop UI | Dank Material Shell |
| Greeter | Dank Material Shell greeter on Niri |
| GPU | NVIDIA |
| Shell | fish |
| Terminal | kitty |
| Editor | Neovim, VS Code FHS |
| File manager | yazi |
| Browser | Google Chrome |
| AI CLI | Codex from pkgsUnstable |
| Gaming | Steam |
| Virtualization | Docker, libvirt, QEMU, virt-manager, Quickemu, Quickgui |
| Remote / network services | OpenSSH, Tailscale, Sunshine |
| Media / creator tools | OBS Studio, SPlayer |
| Proxy GUI | clash-verge-rev |
| Input method | fcitx5 with Chinese addons and Rime |