refactor: make hosts declarative and consolidate shared config
- add my.username / my.gaming.enable / my.ai.local.enable options and gate optional app modules on them instead of per-host import lists - move vendor-neutral hardware.graphics into modules/graphical, leaving only NVIDIA-specific drivers and env vars in modules/hardware/nvidia - derive the primary user everywhere from my.username (users, getty, home-manager, tmpfiles) - de-duplicate Hyprland autostart down to a single system loginShellInit using the start-hyprland wrapper - consolidate all nixpkgs overlays into modules/core/nix.nix and use final.stdenv.hostPlatform.system - make the zsh rebuild helper target $(hostname) instead of hardcoded hades - add nixpkgs follows for nixos-hardware, pi and comfy-ui (single nixpkgs) - add .gitignore and a nixfmt flake formatter; format all nix files - remove empty browser.nix/display-configuration.nix and rename local_ai.nix -> local-ai.nix - document the my.* toggles in the README
This commit is contained in:
35
README.md
35
README.md
@@ -24,10 +24,22 @@ rebuild switch # zsh helper: sudo nixos-rebuild switch --flake ~/NixOS-Configs
|
||||
## Adding a new host (e.g. a laptop)
|
||||
|
||||
1. Create `hosts/<name>/` with `default.nix`, `hardware-configuration.nix`, and
|
||||
(optionally) `disko.nix`; import the shared modules (`modules/core`,
|
||||
`modules/graphical`, `modules/apps`).
|
||||
(optionally) `disko.nix`. Shared modules (`modules/core`, `modules/graphical`,
|
||||
`modules/apps`) are already pulled in by `commonModules` in `flake.nix` — the
|
||||
host only adds its own hardware/disko config.
|
||||
2. Register it in `flake.nix` under `nixosConfigurations`.
|
||||
3. Declare host-specific displays in `hosts/<name>/default.nix`:
|
||||
3. Turn optional features on per machine via the shared `my.*` options:
|
||||
|
||||
```nix
|
||||
# hosts/<name>/default.nix
|
||||
my = {
|
||||
username = "anish"; # default; change for a different primary user
|
||||
gaming.enable = false; # Steam, Gamemode, MangoHud
|
||||
ai.local.enable = false; # Ollama, ComfyUI, Open WebUI
|
||||
};
|
||||
```
|
||||
|
||||
4. Declare host-specific displays in `hosts/<name>/default.nix`:
|
||||
|
||||
```nix
|
||||
home-manager.users.anish.volt.monitors = [
|
||||
@@ -44,4 +56,19 @@ home-manager.users.anish.volt.monitors = [
|
||||
|
||||
The `volt.monitors` default (any output @ preferred) keeps every machine working
|
||||
out of the box; hosts override only what they need. Hosts without an NVIDIA GPU
|
||||
simply don't import `modules/hardware/nvidia.nix` — all vendor env vars live there.
|
||||
simply don't import `modules/hardware/nvidia.nix` — all vendor env vars live there,
|
||||
while the vendor-neutral `hardware.graphics` stack lives in `modules/graphical`.
|
||||
|
||||
## Feature toggles (`my.*`)
|
||||
|
||||
Optional app modules are always imported (via `modules/apps/default.nix`) but only
|
||||
activate when a host sets the corresponding flag, so hosts never need to edit
|
||||
import lists:
|
||||
|
||||
| Option | Enables |
|
||||
| --- | --- |
|
||||
| `my.username` | Primary user (users, home-manager, getty autologin) |
|
||||
| `my.gaming.enable` | Steam, Gamemode, MangoHud |
|
||||
| `my.ai.local.enable` | Ollama (CUDA), ComfyUI, Open WebUI |
|
||||
|
||||
Hardware modules remain explicit imports per host (e.g. `modules/hardware/nvidia.nix`).
|
||||
|
||||
Reference in New Issue
Block a user