# fufexan/dotfiles architecture

> Architecture diagram of the GitHub repository fufexan/dotfiles, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fufexan/dotfiles
- Repository: https://github.com/fufexan/dotfiles

## Overview

##### Project Type and Purpose
- This is a configuration repository for NixOS and Home Manager. It provides modular, host-specific, and user-specific configurations and custom package definitions.
- The README outlines key areas (hosts, home, lib, modules, pkgs, system) and points to outputs from “nix flake show”, confirming that this repository acts as infrastructure or “dotfiles” for a personal/organizational setup.

##### File Structure
- Top-level directories include:
– hosts: Contains host-specific configurations (e.g., for different hardware setups or environments like “io” and “wsl”).
– home: Contains Home Manager configurations for user environments/settings.
– system: Contains NixOS system configurations along with core boot, hardware, networking, and services definitions.
– modules: Custom NixOS modules to extend or override default behaviors.
– pkgs: Custom package definitions, libraries, and possibly helper tools.
– lib: Contains helper functions and additional libraries.
- There are additional directories and files (e.g., .github workflows, flake.nix, default.nix files in various locations) that reveal configuration orchestration, script integrations, and version control hints.
- Multiple “default.nix” files across various component directories indicate the use of the Nix language to declare configurations in a modular and composable way.

##### Elements
a. Main Components:
- Hosts: Representing infrastructure-specific configurations.
- Home: Representing Home Manager configurations that control user-level settings, programs, and editors.
- System: This covers the overall NixOS system configuration including boot, hardware, network, and system services.
- Modules: Custom NixOS modules that allow for extension and reusability across host configurations.
- Pkgs: Package definitions (including custom packages like “bibata-hyprcursor”, “repl”, etc.) that are used or referenced from the other components.
- Lib: Helper functions used across the various configurations.
- Services (seen within both home/services and system/services): These indicate the management and orchestration of desktop widgets (like Ags), network, audio, etc.
b. Relationships and Interactions:
- There is a strong dependency from the “home” and “system” directories on the “modules” and “pkgs” components – they are consumed as assignments for configuring packages and system services.
- The “hosts” directory supplies host-specific overrides; these interact with system-level configurations.
- “lib” provides common functionality to both modules and packages, emphasizing reuse.
- The use of “default.nix” in many places shows a common Nix pattern of default entry points for each configuration module.
c. Architectural Patterns and Design Principles:
- Modular design: Clearly separated by concerns – hosts, user (home), system, etc.
- Declarative configuration: Fully specified by Nix’s declarative language (NixOS and Home Manager).
- Extensibility: The repository is built to be extended with further configurations, modules, and package definitions, making heavy use of the flake’s composability.
d. Technologies and Frameworks:
- Nix, NixOS, and Home Manager are the core frameworks.
- Nix flakes and flake-parts are used to structure and build the configuration.
- The integration of Ags in the “home/services” directory (plus references to Eww for an alternative) indicates widget configuration components used in the desktop environment setup.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Main orchestrator
    FlakeOrchestrator["Flake Orchestrator (flake.nix)"]:::flake

    %% Configuration groups
    HostsCFG["Hosts Config"]:::hosts
    HomeCFG["Home Manager Config"]:::home
    SystemCFG["NixOS System Config"]:::system

    %% Support layers
    M["Custom Modules (modules)"]:::modules
    P["Custom Packages (pkgs)"]:::pkgs
    L["Library Functions (lib)"]:::lib

    %% Home Manager sub-components
    HM_Programs["Programs"]:::home
    HM_Edit["Editors/Terminal"]:::home
    HM_Services["Services (e.g., Ags)"]:::home

    %% NixOS System sub-components
    NS_Core["Core (boot,security,users)"]:::system
    NS_Hardware["Hardware (bluetooth,graphics)"]:::system
    NS_Network["Network (avahi,tailscale,etc)"]:::system
    NS_Services["Services"]:::system

    %% Hosts sub-components
    H_io["hosts/io"]:::hosts
    H_wsl["hosts/wsl"]:::hosts

    %% Arrows from Flake orchestrator to configuration groups and support layers
    FlakeOrchestrator -->|"orchestrates"| HostsCFG
    FlakeOrchestrator -->|"orchestrates"| HomeCFG
    FlakeOrchestrator -->|"orchestrates"| SystemCFG
    FlakeOrchestrator -->|"defines"| M
    FlakeOrchestrator -->|"defines"| P
    FlakeOrchestrator -->|"defines"| L

    %% Arrows from support layers into configurations
    M -->|"extends"| SystemCFG
    P -->|"supplies-packages-to"| HomeCFG
    P -->|"supplies-packages-to"| SystemCFG
    L -->|"provides-to"| M
    L -->|"provides-to"| P

    %% Hosts influences System
    HostsCFG -->|"overrides"| SystemCFG

    %% Home Manager internal breakdown
    HomeCFG --> HM_Programs
    HomeCFG --> HM_Edit
    HomeCFG --> HM_Services

    %% NixOS System internal breakdown
    SystemCFG --> NS_Core
    SystemCFG --> NS_Hardware
    SystemCFG --> NS_Network
    SystemCFG --> NS_Services

    %% Hosts internal breakdown
    HostsCFG --> H_io
    HostsCFG --> H_wsl

    %% Click Events
    click FlakeOrchestrator "https://github.com/fufexan/dotfiles/blob/main/flake.nix"
    click HostsCFG "https://github.com/fufexan/dotfiles/tree/main/hosts"
    click HomeCFG "https://github.com/fufexan/dotfiles/tree/main/home"
    click SystemCFG "https://github.com/fufexan/dotfiles/tree/main/system"
    click M "https://github.com/fufexan/dotfiles/tree/main/modules"
    click P "https://github.com/fufexan/dotfiles/tree/main/pkgs"
    click L "https://github.com/fufexan/dotfiles/tree/main/lib"

    %% Styles
    classDef flake fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef hosts fill:#FFEB99,stroke:#000,stroke-width:2px;
    classDef home fill:#C1FFC1,stroke:#000,stroke-width:2px;
    classDef system fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef modules fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef pkgs fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef lib fill:#AFEEEE,stroke:#000,stroke-width:2px;
```
