A multi-host NixOS flake built on flake-parts + import-tree, covering a Hyprland laptop, a Raspberry Pi home server, and a VM testbed. Themes are handled with Stylix, secrets with sops-nix, and secure boot via lanzaboote.
Each host is just a folder under modules/hosts/ (see ares, hermes, or proteus as a template). To adapt this flake to your own system:
- Create a host folder under
modules/hosts/<your-host>/with at least:default.nix— registers thenixosConfigurations.<your-host>entry and pulls in the modules you want (copy one of the existing hosts as a starting point).hardware.nix— your machine's hardware config, wrapped as a flake module. Runnixos-generate-configon your machine, then take the generatedhardware-configuration.nixcontents and paste them inside aflake.nixosModules.hostXxx = { ... }block (seeares/hardware.nixfor the pattern). If your machine has a matching nixos-hardware profile, import it indefault.nixinstead of hand-writing quirks.home.nix— defines aflake.homeModules.<user>-<hostname>module (e.g.mathai-ares) that the host'sdefault.nixwires intohome-manager.users.<user>.
- Set the hostname via
networking.hostNamein the host'sdefault.nix. - Change the user details. Defaults live in
modules/nixos/config/user.nix(name,fullName,email) — change those, or override them per-host underpreferences.user. The username flows into thehome-manager.users.<name>mapping, so keep them consistent. (Search for the textmathaiin the repo, and if you find it anywhere you probably have to replace it) - Update your git identity in
modules/home/programs/git/.gitconfig(name, email, signing key). - Pick your modules. Each host's
default.niximports only the NixOS/home modules it needs — add or remove things likenvidia,bluetooth,docker, desktop environments, etc.
Default apps are not hard-coded: the terminal and browser modules set preferences.terminal / preferences.browser (e.g. importing homeModules.ghostty sets the terminal to ghostty), and keybinds only exist for what is enabled. See modules/home/desktop/preferences.nix.
By default hosts source user/root passwords from sops, which expects a private .nix-secrets repo (referenced in flake.nix). You can't build those hosts without creating your own secrets repo with matching keys.
To get a working build without sops, follow proteus — it sets preferences.user.useSopsPassword = false and a plain password, so it needs no secrets at all.
| host | role | notes |
|---|---|---|
ares |
HP Omen 16 laptop | Hyprland, Nvidia + AMD, secure boot, btrfs, bluetooth, tailscale |
hermes |
Raspberry Pi 4 server | disko, Jellyfin/*arr stack, Immich, Vaultwarden, Caddy, Glance |
proteus |
VM testbed | Hyprland, auto-login, builds with nixos-rebuild build-vm |
| layer | choice |
|---|---|
| OS | NixOS (nixos-unstable) |
| Flake layout | flake-parts + import-tree |
| WM | Hyprland (niri also wired up) |
| Shell | Quickshell (QML bar, control center, launcher, notifications), colours from Stylix |
| Theming | Stylix (Nord, dark) + Papirus icons |
| Terminal | Ghostty (Kitty also wired up) |
| Editor | Neovim (separate repo, submodule) + Zed |
| Shell | zsh + powerlevel10k, atuin, fzf, zoxide |
| Secrets | sops-nix (private .nix-secrets repo) |
| Boot | lanzaboote (secure boot) |
| Services | Jellyfin, Immich, Vaultwarden, *arr, Caddy, Tailscale |
# Clone (with submodules for the nvim config)
git clone --recurse-submodules git@github.com:mathaimp/.dotfiles ~/.dotfiles
cd ~/.dotfiles
# First build
sudo nixos-rebuild switch --flake .#ares # or hermes / proteus
# Test a change without applying it
sudo nixos-rebuild dry-activate --flake .#aresSome hosts decrypt secrets via sops-nix from a private .nix-secrets repo over SSH. Forward your agent when building those:
sudo --preserve-env=SSH_AUTH_SOCK nixos-rebuild switch --flake .#aresnix develop -c $SHELL # shell with treefmt, deadnix, statix, nil
treefmt # format all .nix files
deadnix . # find dead code
statix check . # lint for anti-patterns