# snipyjulmy/dotfiles architecture

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

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

## Overview

##### Project type and purpose
- This is a dotfiles management repository (personal “infrastructure-as-code”) using chezmoi. Its purpose is to declaratively manage and apply all home-directory configuration (alacritty, nvim, i3, zsh, etc.) across machines.
- Key indicators: the README shows “chezmoi init … apply SnipyJulmy”; the file tree is mostly “home/.” templates and configs.

##### File structure
- Top-level:
- .github/workflows: CI pipelines (ci.yml, gitleaks.yml)
- README.md
- install.sh
- home/: the chezmoi source tree containing templated dotfiles under home/ (e.g. home/.chezmoi.toml.tmpl) and dot_config/ subdirectories
- home/.chezmoiscripts: custom shell hooks run before or during apply
- Many files are .tmpl templates or encrypted (.age) representing secrets
- No “frontend”/“backend”—it’s a toolchain: Git repo → chezmoi → local filesystem

##### README for additional insights
- Relies on age + keybase for encrypted file management
- Uses chezmoi one-shot or persistent init to apply state

a. Main components:
- GitHub repository (dotfiles source)
- GitHub Actions (CI: lint, security scans)
- chezmoi CLI (client on user’s machine)
- Local machine filesystem (home directory layout)
- Encryption service (age + Keybase for secrets)
b. Relationships and interactions:
1. Developer commits/merges to GitHub repo
2. GitHub Actions run CI (ci.yml, gitleaks.yml) on push/pull
3. On a new machine, user runs chezmoi init → clones the repo
4. chezmoi processes:
– Loads home/.chezmoi.toml (config)
– Runs pre-apply scripts (run_once_before_install.sh, run_set_netrc_permissions.sh)
– Decrypts .age files via age + keybase
– Renders templates (.tmpl) into actual dotfiles in ~/.*
5. Final state is the populated local home/ directory
c. Architectural patterns/design principles:
– GitOps / Infrastructure as Code: source of truth is the Git repo
– Template-driven config: chezmoi’s templating engine
– Encrypted secrets managed inline (.age files)
– CI pipeline enforces policy (lint, leak detection)
d. Relevant technologies/frameworks:
– chezmoi (template processing, state management)
– age + Keybase (encryption/decryption)
– GitHub Actions (CI)
– Shell scripts for custom hooks

##### Detailed capture of essential elements
- Hook directory “.chezmoiscripts” feeding into apply workflow
- .tmpl files vs. encrypted .age files under “dotfile source”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Cloud Infrastructure
    subgraph "Cloud Infrastructure"
        direction TB
        Repo["GitHub Repository\n(README.md, install.sh, home/)"]:::cloud
        subgraph "GitHub Actions (CI)" 
            direction TB
            CI_CI["ci.yml"]:::ci
            CI_Gitleaks["gitleaks.yml"]:::ci
        end
        Encryption["Encryption Service\n(age + Keybase)"]:::cloud
    end

    %% Repository source subcomponents
    subgraph "Repository Source"
        direction TB
        Cfg1[".chezmoi.toml.tmpl"]:::local
        Cfg2[".chezmoiexternal.toml.tmpl"]:::local
        Cfg3[".chezmoiignore.tmpl"]:::local

        subgraph "Pre-apply Hook Scripts\n(.chezmoiscripts)"
            direction TB
            Hook1["run_once_before_install.sh.tmpl"]:::local
            Hook2["run_set_netrc_permissions.sh"]:::local
        end

        subgraph "Template-driven Dotfiles\n(.tmpl files)"
            direction TB
            Tpl1["kitty.conf.tmpl"]:::local
            Tpl2["dot_gitconfig.tmpl"]:::local
            Tpl3["dot_tmux.conf.tmpl"]:::local
            Tpl4["dot_zshenv.tmpl"]:::local
            Tpl5["dot_zshrc.tmpl"]:::local
            Tpl6["_chezmoi.tmpl"]:::local
        end

        subgraph "Encrypted Secrets\n(.age files)"
            direction TB
            E1["encrypted_private_hosts.yml.age"]:::cloud
            E2["encrypted_private_config.yml.age"]:::cloud
            E3["encrypted_dot_config.yml.age"]:::cloud
            E4["encrypted_gemini_api_key.zsh.age"]:::cloud
            E5["encrypted_insel.zshrc.age"]:::cloud
            E6["encrypted_metis.zshrc.age"]:::cloud
            E7["encrypted_private_dot_netrc.age"]:::cloud
        end
    end

    %% Local Machine Components
    subgraph "Local Machine"
        direction TB
        CLI["chezmoi CLI"]:::local
        FS["Local Home FS\n(~/.config, ~/.zshrc, etc)"]:::local
    end

    %% Flows
    Repo -->|"on push/pull"| CI_CI
    Repo -->|"on push/pull"| CI_Gitleaks
    Repo -->|"clone on init"| CLI
    CI_CI -->|"CI checks"| Repo
    CI_Gitleaks -->|"leak detection"| Repo
    CLI -->|"reads config"| Cfg1
    CLI -->|"reads config"| Cfg2
    CLI -->|"reads config"| Cfg3
    CLI -->|"runs hooks"| Hook1
    CLI -->|"runs hooks"| Hook2
    CLI -->|"decrypts secrets"| Encryption
    Encryption -->|"provides plaintext"| CLI
    CLI -->|"renders templates"| Tpl1
    CLI -->|"renders templates"| Tpl2
    CLI -->|"renders templates"| Tpl3
    CLI -->|"renders templates"| Tpl4
    CLI -->|"renders templates"| Tpl5
    CLI -->|"renders templates"| Tpl6
    CLI -->|"writes files"| FS

    %% Click events
    click CI_CI "https://github.com/snipyjulmy/dotfiles/blob/master/.github/workflows/ci.yml"
    click CI_Gitleaks "https://github.com/snipyjulmy/dotfiles/blob/master/.github/workflows/gitleaks.yml"
    click Cfg1 "https://github.com/snipyjulmy/dotfiles/blob/master/home/.chezmoi.toml.tmpl"
    click Cfg2 "https://github.com/snipyjulmy/dotfiles/blob/master/home/.chezmoiexternal.toml.tmpl"
    click Cfg3 "https://github.com/snipyjulmy/dotfiles/blob/master/home/.chezmoiignore.tmpl"
    click Hook1 "https://github.com/snipyjulmy/dotfiles/blob/master/home/.chezmoiscripts/run_once_before_install.sh.tmpl"
    click Hook2 "https://github.com/snipyjulmy/dotfiles/blob/master/home/.chezmoiscripts/run_set_netrc_permissions.sh"
    click E1 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_config/gh/encrypted_private_hosts.yml.age"
    click E2 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_config/glab-cli/encrypted_private_config.yml.age"
    click E3 "https://github.com/snipyjulmy/dotfiles/blob/master/home/private_dot_jira/encrypted_dot_config.yml.age"
    click E4 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_zsh/encrypted_gemini_api_key.zsh.age"
    click E5 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_zsh/encrypted_insel.zshrc.age"
    click E6 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_zsh/encrypted_metis.zshrc.age"
    click E7 "https://github.com/snipyjulmy/dotfiles/blob/master/home/encrypted_private_dot_netrc.age"
    click Tpl1 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_config/kitty/kitty.conf.tmpl"
    click Tpl2 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_gitconfig.tmpl"
    click Tpl3 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_tmux.conf.tmpl"
    click Tpl4 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_zshenv.tmpl"
    click Tpl5 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_zshrc.tmpl"
    click Tpl6 "https://github.com/snipyjulmy/dotfiles/blob/master/home/dot_oh-my-zsh/completions/_chezmoi.tmpl"

    %% Styles
    classDef cloud fill:#B3D4FC,stroke:#333,stroke-width:1px
    classDef ci fill:#FBE983,stroke:#333,stroke-width:1px
    classDef local fill:#C6F6D5,stroke:#333,stroke-width:1px
```
