# kentoje/dotfiles architecture

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

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

## Overview

##### Main Components
- Dotfiles Repository: The central codebase containing all configurations, setup scripts, and assets.
- Nix System Configuration:
– Separate configurations like nix-darwin-pro and nix-darwin-mini along with general Nix flake files.
– These are responsible for installing Homebrew packages (via Nix) and managing system-level configuration.
- Stow Configuration:
– This represents how the repository uses GNU Stow to create symlinks from the dotfiles repository to the home directory.
- Application/Tool Configurations:
– Terminal emulators (Alacritty, kitty, wezterm)
– Shell (fish) with its completions, functions, and plugins.
– Editors (nvim and its extensive plugin setup)
– Utility tools (tmux, lazygit, btop, sketchybar, hammerspoon, etc.)
- Assets & Setup Scripts:
– Setup scripts in the “setup” directory automate system initialization on macOS.

##### Relationships & Dataflows
- Installation Process:
– The “setup/macos” scripts are executed first to initiate system-level tasks (installing Nix, running Stow to symlink dotfiles).
– These scripts use Nix to install and maintain Homebrew applications and system packages.
- Symlink Management:
– Stow reads the structure within the dotfiles repository and creates symlinks in the appropriate home directory locations.
- Application Configuration:
– Once symlinked, each individual application (such as nvim, tmux, fish, etc.) reads its configuration from the dotfiles.
- Update & Management:
– A “nix flake update” process is defined in the README, indicating that the Nix configurations have a directed update and rebuild cycle (using commands like “darwin-rebuild”).

##### Architectural Patterns & Design Principles
- Modularity: Each configuration an application is isolated in its own directory (e.g., .config/nvim, .config/fish, .config/tmux, etc.), making it clear which file belongs to which tool.
- Declarative Management: Use of Nix and flakes promotes a declarative, reproducible system setup.
- Automation & Scripting: The “setup/macos” scripts and configuration files for package managers help automate environment provisioning.
- Separation of Concerns: System-level configuration (via Nix and stow) is clearly separated from application-specific configurations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    D["Dotfiles Repository"]:::repo
    D --> AC["Application Configurations"]:::config
    D --> A["Assets"]:::assets
    D --> S["Setup Scripts"]:::scripts
    D --> ST["Stow: Symlink Creation"]:::process
    ST --> HD["Home Directory Configuration"]:::external

    subgraph "Application Configurations"
        subgraph "Terminal Emulators"
            AL["Alacritty"]:::config
            KI["Kitty"]:::config
            WE["Wezterm"]:::config
        end
        F["Fish (Shell)"]:::config
        N["Neovim (Editor)"]:::config
        subgraph "Utility Tools"
            TM["Tmux"]:::config
            LG["Lazygit"]:::config
            SB["Sketchybar"]:::config
            HS["Hammerspoon"]:::config
        end
    end

    S -->|"install_via_Nix"| NX["Nix System Configuration"]:::config
    NX --> NIM["nix-darwin-mini"]:::config
    NX --> NIP["nix-darwin-pro"]:::config
    NX -->|"manages"| HB["Homebrew & Package Managers"]:::external
    S -->|"fetch_plugins"| EX["External Services"]:::external

    %% Click Events
    click D "https://github.com/kentoje/dotfiles/blob/main/."
    click AL "https://github.com/kentoje/dotfiles/tree/main/.config/alacritty"
    click KI "https://github.com/kentoje/dotfiles/tree/main/.config/kitty"
    click WE "https://github.com/kentoje/dotfiles/tree/main/.config/wezterm"
    click F "https://github.com/kentoje/dotfiles/tree/main/.config/fish"
    click N "https://github.com/kentoje/dotfiles/tree/main/.config/nvim"
    click TM "https://github.com/kentoje/dotfiles/tree/main/.config/tmux"
    click LG "https://github.com/kentoje/dotfiles/tree/main/.config/lazygit"
    click SB "https://github.com/kentoje/dotfiles/tree/main/.config/sketchybar"
    click HS "https://github.com/kentoje/dotfiles/blob/main/.hammerspoon"
    click NIP "https://github.com/kentoje/dotfiles/tree/main/.config/nix-darwin-pro"
    click NIM "https://github.com/kentoje/dotfiles/tree/main/.config/nix-darwin-mini"
    click A "https://github.com/kentoje/dotfiles/tree/main/assets"
    click S "https://github.com/kentoje/dotfiles/tree/main/setup/macos"

    %% Styles
    classDef repo fill:#FFCCFF,stroke:#333,stroke-width:2px;
    classDef config fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef scripts fill:#FFCCEE,stroke:#333,stroke-width:2px;
    classDef assets fill:#CCFFFF,stroke:#333,stroke-width:2px;
    classDef external fill:#FFFFCC,stroke:#333,stroke-width:2px;
    classDef process fill:#FFDDAA,stroke:#333,stroke-width:2px;
```
