65 lines
2.1 KiB
Markdown
65 lines
2.1 KiB
Markdown
|
|
# features/ - Modular Home Manager Features
|
||
|
|
|
||
|
|
Toggle-able feature modules using `mkEnableOption` pattern.
|
||
|
|
|
||
|
|
## Structure
|
||
|
|
|
||
|
|
```
|
||
|
|
features/
|
||
|
|
├── cli/ # Shell & terminal tools
|
||
|
|
│ ├── default.nix # Always-on CLI tools (bat, eza, direnv, carapace)
|
||
|
|
│ ├── nushell.nix # features.cli.nushell.enable
|
||
|
|
│ ├── fzf.nix # features.cli.fzf.enable
|
||
|
|
│ ├── starship.nix # features.cli.starship.enable
|
||
|
|
│ ├── zellij.nix # Always-on zellij config
|
||
|
|
│ └── secrets.nix # features.cli.secrets.enable
|
||
|
|
├── coding/ # Dev tools
|
||
|
|
│ └── default.nix # features.coding.* (zed, neovim)
|
||
|
|
└── desktop/ # GUI applications
|
||
|
|
├── default.nix # Always-on (kitty, xdg, cursor)
|
||
|
|
├── hyprland.nix # features.desktop.hyprland.enable
|
||
|
|
├── gaming.nix # features.desktop.gaming.enable
|
||
|
|
├── media.nix # features.desktop.media.enable
|
||
|
|
└── ...
|
||
|
|
```
|
||
|
|
|
||
|
|
## Creating a New Feature
|
||
|
|
|
||
|
|
1. Create `<category>/<feature>.nix`:
|
||
|
|
```nix
|
||
|
|
{config, lib, ...}:
|
||
|
|
with lib; let
|
||
|
|
cfg = config.features.<category>.<feature>;
|
||
|
|
in {
|
||
|
|
options.features.<category>.<feature>.enable =
|
||
|
|
mkEnableOption "description";
|
||
|
|
|
||
|
|
config = mkIf cfg.enable {
|
||
|
|
# Configuration when enabled
|
||
|
|
};
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
2. Import in `<category>/default.nix`
|
||
|
|
3. Enable in user configs: `features.<category>.<feature>.enable = true;`
|
||
|
|
|
||
|
|
## Feature Categories
|
||
|
|
|
||
|
|
| Category | Purpose | Key features |
|
||
|
|
|----------|---------|--------------|
|
||
|
|
| cli | Shell tools | nushell, fzf, starship, nitch, secrets |
|
||
|
|
| coding | Development | (in default.nix, no sub-features yet) |
|
||
|
|
| desktop | GUI/WM | hyprland, gaming, media, office, crypto, fonts, rofi, wayland |
|
||
|
|
|
||
|
|
## Always-On vs Toggle-able
|
||
|
|
|
||
|
|
- **default.nix**: Configuration that applies when the category is imported (no enable flag)
|
||
|
|
- **<feature>.nix**: Must be explicitly enabled via `features.*.enable = true`
|
||
|
|
|
||
|
|
## Desktop Feature Details
|
||
|
|
|
||
|
|
- `hyprland.nix`: Window manager config, keybinds, window rules (host overrides monitors/workspaces)
|
||
|
|
- `gaming.nix`: Steam, gamemode, mangohud
|
||
|
|
- `media.nix`: mpv, obs-studio, spotify
|
||
|
|
- `wayland.nix`: Clipboard, screenshots, idle management
|