# ryuheechul/dotfiles architecture

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

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

## Overview

##### Project Type and Purpose
- This is neither a web app nor a compiler but an “infrastructure‑as‑code” or dotfiles repository.
- Purpose: centrally manage and bootstrap a developer workstation (macOS, Linux, NixOS) by versioning all shell configs, editor configs, package definitions, keybindings, and bootstrap scripts.

##### High-Level Architectural Components
- Dotfiles Git Repository
- Holds all configuration, scripts, and package definitions.
- Bootstrap Foundation Scripts
- Platform‑specific folders (bootstrap/foundation/{darwin,linux,nixos}) → install package managers, symlink configs.
- Configuration Script
- bootstrap/configuration.sh → orchestrates installation of common tools.
- Package Managers & Package Definitions
- Nix (nix/, home-manager, nixos modules)
- Homebrew (brew/Brewfile, dep.Brewfile)
- asdf (asdf/tool-versions)
- Shell Configuration
- Zsh (zsh/, zshrc.d/)
- Starship prompt (starship.toml)
- Aliases (aliases/)
- Shell‑level utilities and integrations
- Editor Configurations
- Neovim (nvim/)
- Vim/SpaceVim (SpaceVim.d/)
- Emacs (emacs.d/)
- Snippets, plugin managers, language servers
- Terminal & UI Tools
- Alacritty (alacritty/)
- tmux configuration (tmux.conf), Zellij (zellij/)
- Hyper.js, lf, bat, gh, ghostty, espanso
- OS‑level Integrations & Keybindings
- Karabiner (karabiner/) for macOS
- AutoHotkey (autohotkey/) for Windows via WSL
- Custom Binaries & Utilities
- bin/ (helper scripts used by various stages)
- setup.sh entrypoint

##### Relationships and Data Flow
- Developer runs setup.sh or directly invokes bootstrap scripts
→ Scripts read configuration files in the repo
→ Install or configure package managers (Nix, Homebrew, asdf)
→ Use package managers to install tools/packages (via brew/Brewfile, nix/*, asdf/tool-versions)
→ Symlink dotfiles into home directory (zsh, editor, terminal configs)
- At runtime, user shells (Zsh) source zshrc.d/ and modules
→ Load aliases, path adjustments, plugin integrations (fzf, git, tmux)
- When launching an editor, its plugin manager (lazy.nvim, Doom Emacs, SpaceVim) loads from respective config directories
- OS‑level keybinding tools (Karabiner, AutoHotkey) load JSON configs to remap keys

##### Key Architectural Patterns
- Modular directory structure per tool/service
- “Bootstrapping” pattern: sequence of scripts that bring a clean machine to a fully configured dev workstation
- Layered package management: OS package manager (Homebrew/Nix), version manager (asdf), language‑specific package managers
- Declarative config for NixOS and Home Manager
- Plugin‑driven editor configurations

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Central Repository
    GitRepo["Dotfiles Git Repository"]:::external
    GitRemote["Git Remote"]:::external
    GitRemote --> GitRepo

    %% Bootstrap Layer
    subgraph "Bootstrap" 
        Setup["setup.sh"]:::scripts
        ConfigScript["bootstrap/configuration.sh"]:::scripts
        Setup --> ConfigScript
        subgraph "Foundation Scripts"
            DarwinEssential["darwin/essential.sh"]:::scripts
            DarwinExtra["darwin/extra.sh"]:::scripts
            LinuxFS["linux.sh"]:::scripts
            NixGen["gen-configuration.sh"]:::scripts
            NixRebuild["nixos-rebuild.sh"]:::scripts
            NixSwitch["switch.sh"]:::scripts
            WSLFS["wsl.sh"]:::scripts
        end
        ConfigScript --> DarwinEssential
        ConfigScript --> DarwinExtra
        ConfigScript --> LinuxFS
        ConfigScript --> NixGen
        ConfigScript --> NixRebuild
        ConfigScript --> NixSwitch
        ConfigScript --> WSLFS
    end
    GitRepo --> Setup

    %% Package Managers & Definitions
    subgraph "Package Managers & Definitions"
        Nix["nix/"]:::pkg
        Brewfile["brew/Brewfile"]:::pkg
        DepBrewfile["brew/dep.Brewfile"]:::pkg
        ASDF["asdf/tool-versions"]:::pkg
    end
    ConfigScript --> Nix
    ConfigScript --> Brewfile
    ConfigScript --> DepBrewfile
    ConfigScript --> ASDF

    Nix --> Nixpkgs["Nixpkgs Registry"]:::external
    Brewfile --> HomebrewRegistry["Homebrew Registry"]:::external
    DepBrewfile --> HomebrewRegistry
    ASDF --> ASDFRegistry["asdf Plugins"]:::external

    %% Shell Configuration
    subgraph "Shell Configuration"
        Zsh["zsh/"]:::runtime
        ZshRC["zshrc.d/"]:::runtime
        Aliases["aliases/"]:::runtime
        Starship["starship.toml"]:::runtime
    end
    ConfigScript --> Zsh
    ConfigScript --> ZshRC
    ConfigScript --> Aliases
    ConfigScript --> Starship

    %% Editor Configurations
    subgraph "Editor Configurations"
        Neovim["nvim/"]:::runtime
        SpaceVim["SpaceVim.d/"]:::runtime
        Emacs["emacs.d/"]:::runtime
    end
    ConfigScript --> Neovim
    ConfigScript --> SpaceVim
    ConfigScript --> Emacs

    %% UI & Terminal Tools
    subgraph "UI & Terminal Tools"
        AlacUnix["alacritty/unix.toml"]:::runtime
        AlacWin["alacritty/win.toml"]:::runtime
        Tmux["tmux.conf"]:::runtime
        ZellijCfg["zellij/config.kdl"]:::runtime
        ZellijTheme["zellij/themes/solarized.kdl"]:::runtime
        Hyper["hyper.js"]:::runtime
        LF["lf/lfrc"]:::runtime
        BatConfig["bat/config"]:::runtime
        BatSyntax["bat/syntaxes"]:::runtime
        GH["gh/config.yml"]:::runtime
        Ghostty["ghostty/config"]:::runtime
        EspansoInstall["espanso/bin/install-pkgs.sh"]:::runtime
        EspansoCfg["espanso/config/default.yml"]:::runtime
    end
    ConfigScript --> AlacUnix
    ConfigScript --> AlacWin
    ConfigScript --> Tmux
    ConfigScript --> ZellijCfg
    ConfigScript --> Hyper
    ConfigScript --> LF
    ConfigScript --> BatConfig
    ConfigScript --> BatSyntax
    ConfigScript --> GH
    ConfigScript --> Ghostty
    ConfigScript --> EspansoInstall
    ConfigScript --> EspansoCfg
    ZellijCfg --> ZellijTheme

    %% OS Integrations & Keybindings
    subgraph "OS Integrations & Keybindings"
        Karabiner["karabiner/karabiner.json"]:::runtime
        KarabinerUK["karabiner-uk/karabiner.json"]:::runtime
        AutoHotkey["autohotkey/my-hotkeys.ahk"]:::runtime
    end
    ConfigScript --> Karabiner
    ConfigScript --> KarabinerUK
    ConfigScript --> AutoHotkey

    %% Custom Binaries & Utilities
    subgraph "Custom Binaries & Utilities"
        Bin["bin/"]:::scripts
    end
    ConfigScript --> Bin

    %% Runtime Flows
    ShellStart["Shell Startup"]:::external
    ShellStart --> Zsh
    Zsh --> ZshRC
    ZshRC --> Aliases
    Zsh --> Starship

    EditorStart["Editor Launch"]:::external
    EditorStart --> Neovim
    EditorStart --> SpaceVim
    EditorStart --> Emacs

    TerminalStart["Terminal Launch"]:::external
    TerminalStart --> AlacUnix
    TerminalStart --> Tmux
    TerminalStart --> ZellijCfg

    KeybindingLoad["Keybinding Load"]:::external
    KeybindingLoad --> Karabiner
    KeybindingLoad --> AutoHotkey

    %% Styles
    classDef scripts fill:#D0E6FF,stroke:#4A90E2,stroke-width:1px
    classDef pkg fill:#DFF8E1,stroke:#27AE60,stroke-width:1px
    classDef runtime fill:#FFE6B3,stroke:#E67E22,stroke-width:1px
    classDef external fill:#ECECEC,stroke:#7F8C8D,stroke-width:1px

    %% Click Events
    click GitRepo "https://github.com/ryuheechul/dotfiles/tree/master//"
    click Setup "https://github.com/ryuheechul/dotfiles/blob/master/setup.sh"
    click ConfigScript "https://github.com/ryuheechul/dotfiles/blob/master/bootstrap/configuration.sh"
    click DarwinEssential "https://github.com/ryuheechul/dotfiles/blob/master/bootstrap/foundation/darwin/essential.sh"
    click DarwinExtra "https://github.com/ryuheechul/dotfiles/blob/master/bootstrap/foundation/darwin/extra.sh"
    click LinuxFS "https://github.com/ryuheechul/dotfiles/blob/master/bootstrap/foundation/linux.sh"
    click NixGen "https://github.com/ryuheechul/dotfiles/blob/master/bootstrap/foundation/nixos/gen-configuration.sh"
    click NixRebuild "https://github.com/ryuheechul/dotfiles/blob/master/bootstrap/foundation/nixos/nixos-rebuild.sh"
    click NixSwitch "https://github.com/ryuheechul/dotfiles/blob/master/bootstrap/foundation/nixos/switch.sh"
    click WSLFS "https://github.com/ryuheechul/dotfiles/blob/master/bootstrap/foundation/wsl.sh"
    click Nix "https://github.com/ryuheechul/dotfiles/tree/master/nix/"
    click Brewfile "https://github.com/ryuheechul/dotfiles/tree/master/brew/Brewfile"
    click DepBrewfile "https://github.com/ryuheechul/dotfiles/blob/master/brew/dep.Brewfile"
    click ASDF "https://github.com/ryuheechul/dotfiles/tree/master/asdf/tool-versions"
    click Zsh "https://github.com/ryuheechul/dotfiles/tree/master/zsh/"
    click ZshRC "https://github.com/ryuheechul/dotfiles/tree/master/zshrc.d/"
    click Aliases "https://github.com/ryuheechul/dotfiles/tree/master/aliases/"
    click Starship "https://github.com/ryuheechul/dotfiles/blob/master/starship.toml"
    click Neovim "https://github.com/ryuheechul/dotfiles/tree/master/nvim/"
    click SpaceVim "https://github.com/ryuheechul/dotfiles/tree/master/SpaceVim.d/"
    click Emacs "https://github.com/ryuheechul/dotfiles/tree/master/emacs.d/"
    click AlacUnix "https://github.com/ryuheechul/dotfiles/blob/master/alacritty/unix.toml"
    click AlacWin "https://github.com/ryuheechul/dotfiles/blob/master/alacritty/win.toml"
    click Tmux "https://github.com/ryuheechul/dotfiles/blob/master/tmux.conf"
    click ZellijCfg "https://github.com/ryuheechul/dotfiles/blob/master/zellij/config.kdl"
    click ZellijTheme "https://github.com/ryuheechul/dotfiles/blob/master/zellij/themes/solarized.kdl"
    click Hyper "https://github.com/ryuheechul/dotfiles/blob/master/hyper.js"
    click LF "https://github.com/ryuheechul/dotfiles/tree/master/lf/lfrc"
    click BatConfig "https://github.com/ryuheechul/dotfiles/tree/master/bat/config"
    click BatSyntax "https://github.com/ryuheechul/dotfiles/tree/master/bat/syntaxes"
    click GH "https://github.com/ryuheechul/dotfiles/blob/master/gh/config.yml"
    click Ghostty "https://github.com/ryuheechul/dotfiles/tree/master/ghostty/config"
    click EspansoInstall "https://github.com/ryuheechul/dotfiles/blob/master/espanso/bin/install-pkgs.sh"
    click EspansoCfg "https://github.com/ryuheechul/dotfiles/blob/master/espanso/config/default.yml"
    click Karabiner "https://github.com/ryuheechul/dotfiles/blob/master/karabiner/karabiner.json"
    click KarabinerUK "https://github.com/ryuheechul/dotfiles/blob/master/karabiner-uk/karabiner.json"
    click AutoHotkey "https://github.com/ryuheechul/dotfiles/blob/master/autohotkey/my-hotkeys.ahk"
    click Bin "https://github.com/ryuheechul/dotfiles/tree/master/bin/"
```
