# nicolas-rezende/home-manager architecture

> Architecture diagram of the GitHub repository nicolas-rezende/home-manager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nicolas-rezende/home-manager
- Repository: https://github.com/nicolas-rezende/home-manager

## Overview

##### Project type and purpose
- This is a Nix flake managing configurations for both macOS (via `darwin/`) and user environments (via `home-manager/`), along with versioned dotfiles.
- The goal is to declaratively configure:
- A macOS system (Darwin)
- The user’s shell, Git, Zsh, etc. (Home Manager)
- Dotfiles and secret files

##### File structure
- Top-level:
- `flake.nix` + `flake.lock`: the Nix flake entry point, pins inputs.
- `.gitattributes`, `README.md`: repo metadata.
- `darwin/`: Nix modules for macOS (home-managed with nix-darwin).
- `home-manager/`: modules for user environment (shell, Git, Zsh).
- `dotfiles/`: raw config files (e.g. Ghostty, linearmouse, Ray).
- `secrets/`: private items (e.g. `.npmrc`).
- Patterns:
- The flake outputs likely expose `darwinConfigurations`, `homeConfigurations`, and a `dotfiles` target.
- Each subdirectory contains `.nix` modules that plug into the flake.

##### README for additional insights
- README is minimal (`# nix`), so the file layout is the main source of truth. Expect flake inputs for `nixpkgs`, `darwin`, `home-manager`.

##### Detailing essentials
- Module’s role is captured (e.g., `darwin/macbook.nix` configures hardware-specific settings; `home-manager/zsh.nix` installs and configures Zsh).
- Flow from versioned flake lock → reproducible builds.
- Keep labels concise but specific.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Flake Root
    subgraph "Flake Root"
        flakeNix["Flake Root (flake.nix)"]:::flake
        flakeLock["Flake Lock (flake.lock)"]:::flake
    end

    %% External Inputs
    nixpkgs[(nixpkgs)]:::external
    darwinInput[(nix-darwin)]:::external
    hmInput[(home-manager)]:::external

    %% Darwin Modules
    subgraph "Darwin Modules"
        brewNix["brew.nix"]:::module
        macbookNix["macbook.nix"]:::module
        systemNix["system.nix"]:::module
    end

    %% Home-Manager Modules
    subgraph "Home-Manager Modules"
        defaultNix["default.nix"]:::module
        gitNix["git.nix"]:::module
        zshNix["zsh.nix"]:::module
    end

    %% Dotfiles
    subgraph "Dotfiles"
        dotGhostty["ghostty-config"]:::folder
        dotLinear["linearmouse.json"]:::folder
        dotRay["macbook.rayconfig"]:::folder
    end

    %% Secrets
    subgraph "Secrets"
        secretNpm[".npmrc"]:::folder
    end

    %% Outputs
    macSystem(("macOS System")):::output
    userEnv(("User Environment")):::output

    %% Connections
    flakeNix --> nixpkgs
    flakeNix --> darwinInput
    flakeNix --> hmInput

    flakeNix --> brewNix
    flakeNix --> macbookNix
    flakeNix --> systemNix
    brewNix --> darwinInput
    macbookNix --> darwinInput
    systemNix --> darwinInput
    darwinInput --> macSystem

    flakeNix --> defaultNix
    flakeNix --> gitNix
    flakeNix --> zshNix
    defaultNix --> hmInput
    gitNix --> hmInput
    zshNix --> hmInput
    hmInput --> userEnv

    flakeNix --> dotGhostty
    flakeNix --> dotLinear
    flakeNix --> dotRay
    flakeNix --> secretNpm

    dotGhostty --> defaultNix
    dotLinear --> defaultNix
    dotRay --> defaultNix
    secretNpm --> defaultNix

    %% Click Events
    click flakeNix "https://github.com/nicolas-rezende/home-manager/blob/main/flake.nix"
    click flakeLock "https://github.com/nicolas-rezende/home-manager/blob/main/flake.lock"
    click brewNix "https://github.com/nicolas-rezende/home-manager/blob/main/darwin/brew.nix"
    click macbookNix "https://github.com/nicolas-rezende/home-manager/blob/main/darwin/macbook.nix"
    click systemNix "https://github.com/nicolas-rezende/home-manager/blob/main/darwin/system.nix"
    click defaultNix "https://github.com/nicolas-rezende/home-manager/blob/main/home-manager/default.nix"
    click gitNix "https://github.com/nicolas-rezende/home-manager/blob/main/home-manager/git.nix"
    click zshNix "https://github.com/nicolas-rezende/home-manager/blob/main/home-manager/zsh.nix"
    click dotGhostty "https://github.com/nicolas-rezende/home-manager/tree/main/dotfiles/ghostty-config"
    click dotLinear "https://github.com/nicolas-rezende/home-manager/blob/main/dotfiles/linearmouse.json"
    click dotRay "https://github.com/nicolas-rezende/home-manager/blob/main/dotfiles/macbook.rayconfig"
    click secretNpm "https://github.com/nicolas-rezende/home-manager/blob/main/secrets/.npmrc"

    %% Styles
    classDef flake fill:#ffe599,stroke:#000,stroke-width:2px
    classDef external fill:#b6d7a8,stroke:#000
    classDef module fill:#9fc5e8,stroke:#000
    classDef folder fill:#f9cb9c,stroke:#000
    classDef output fill:#d9d9d9,stroke:#000,stroke-dasharray: 5 5
```
