# hobr/my-nix architecture

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

- Interactive diagram: https://gitdiagram.com/hobr/my-nix
- Repository: https://github.com/hobr/my-nix

## Overview

##### Main Components
- Home/Developer/User Configuration: Under “module/home” you have subdirectories such as desktop configurations (e.g., hypr, rofi, waybar), development environment setups (direnv, editor, git, gpg, nix), media configuration, software settings, and additional utility modules.
- Package Overlays and Custom Packages: The “overlay” and “pkg” directories include customized package definitions and patches for third-party software (e.g., aegisub, rime-ice). These build on or override the default Nix package definitions.
- User Specific Configurations: The “user” directory manages the configurations specific to individual users with different needs.
- Ancillary Configuration/Build Files: Files like flake.nix, Makefile, .gitignore, and others indicate how the overall configuration is built, versioned, and deployed.
- Hardware & Host Specificity: The README explains three separate host machines, each with distinct configurations drawn from the system and home modules.

##### Relationships and Interactions
- A central Flake or Entry Point to the configuration that ties together all modules.
- Different host machines (handsonic, distortion, overdrive) as nodes that receive specific subsets or layers of the configuration. Link these nodes back to the relevant modules (for example, handsonic might be tied to the “handsonic” configurations under system and user directories).

##### Architectural Patterns/Principles
- Declarative Infrastructure: The use of Flakes and Nix expressions emphasizes reproducibility and declarative configuration.

##### Relevant Technologies/Frameworks
- Nix and NixOS: Clearly indicate these as the underlying tech driving the entire configuration.
- Nix Flakes: Mark the flake integration (flake.nix, flake.nix lock file) that ties together multiple modules.
- Tools such as systemd, secure boot (TPM, sbctl), and other utilities (docker, teamviewer, etc.) appear within the system modules, so they should be noted alongside the appropriate modules.
- Overlay Mechanism: Illustrate how “overlay” and “pkg” directories are merged into the Nix package graph.

## Diagram (Mermaid)

```mermaid
flowchart TD
    CF["Central Flake Entry Point"]:::flake

    subgraph "System Modules"
        SM["NixOS System Modules"]:::system
        Boot["Boot Configuration"]:::system
        SC["System Configuration"]:::system
        GPU["GPU Setup"]:::system
        DM["Disk Management"]:::system
        IO["Hardware I/O"]:::system
        SP["System Programs"]:::system
        DESK["Desktop Environment System Settings"]:::system
    end

    subgraph "Home Modules"
        HM["Home/Developer/User Configuration"]:::home
        HC1["Desktop Configurations"]:::home
        HC2["Development Environment Setup"]:::home
        HC3["Media Configuration"]:::home
        HC4["Professional/Home User Configurations"]:::home
        HC5["Software and Terminal Configurations"]:::home
        HC6["Home Utility Modules"]:::home
        HC7["Web/Internet Related Configurations"]:::home
    end

    subgraph "Package & Overlay"
        PO["Package Overlays"]:::overlays
        CP["Custom Package Definitions"]:::overlays
    end

    US["User Specific Configurations"]:::home

    subgraph "Host Machines"
        H1["handsonic"]:::hosts
        H2["distortion"]:::hosts
        H3["overdrive"]:::hosts
    end

    %% Central orchestration
    CF --> SM
    CF --> HM
    CF --> PO
    CF --> US
    CF --> H1
    CF --> H2
    CF --> H3

    %% Break down System Modules
    SM --> Boot
    SM --> SC
    SM --> GPU
    SM --> DM
    SM --> IO
    SM --> SP
    SM --> DESK

    %% Break down Home Modules
    HM --> HC1
    HM --> HC2
    HM --> HC3
    HM --> HC4
    HM --> HC5
    HM --> HC6
    HM --> HC7

    %% Overlay integration
    PO --> CP
    CP -->|"overrides"| SM

    %% Styles
    classDef flake fill:#AED6F1,stroke:#000,stroke-width:2px;
    classDef system fill:#D5F5E3,stroke:#000,stroke-width:2px;
    classDef home fill:#FCF3CF,stroke:#000,stroke-width:2px;
    classDef overlays fill:#F5B7B1,stroke:#000,stroke-width:2px;
    classDef hosts fill:#D6EAF8,stroke:#000,stroke-width:2px;

    %% Click Events
    click CF "https://github.com/hobr/my-nix/blob/main/flake.nix"
    click SM "https://github.com/hobr/my-nix/tree/main/module/system"
    click Boot "https://github.com/hobr/my-nix/tree/main/module/system/boot"
    click SC "https://github.com/hobr/my-nix/tree/main/module/system/config"
    click GPU "https://github.com/hobr/my-nix/tree/main/module/system/gpu"
    click DM "https://github.com/hobr/my-nix/tree/main/module/system/disk"
    click IO "https://github.com/hobr/my-nix/tree/main/module/system/io"
    click SP "https://github.com/hobr/my-nix/tree/main/module/system/program"
    click DESK "https://github.com/hobr/my-nix/tree/main/module/system/desk"
    click HM "https://github.com/hobr/my-nix/tree/main/module/home"
    click HC1 "https://github.com/hobr/my-nix/tree/main/module/home/desktop"
    click HC2 "https://github.com/hobr/my-nix/tree/main/module/home/dev"
    click HC3 "https://github.com/hobr/my-nix/tree/main/module/home/media"
    click HC4 "https://github.com/hobr/my-nix/tree/main/module/home/pro"
    click HC5 "https://github.com/hobr/my-nix/tree/main/module/home/software"
    click HC6 "https://github.com/hobr/my-nix/tree/main/module/home/util"
    click HC7 "https://github.com/hobr/my-nix/tree/main/module/home/web"
    click PO "https://github.com/hobr/my-nix/tree/main/overlay"
    click CP "https://github.com/hobr/my-nix/tree/main/pkg"
    click US "https://github.com/hobr/my-nix/tree/main/user"
    click H1 "https://github.com/hobr/my-nix/blob/main/system/handsonic.nix"
    click H2 "https://github.com/hobr/my-nix/blob/main/system/distortion.nix"
```
