# 0xtux/nixos-config architecture

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

- Interactive diagram: https://gitdiagram.com/0xtux/nixos-config
- Repository: https://github.com/0xtux/nixos-config

## Overview

##### Main Components

a. Host Management Layer
- Multiple host configurations (sirius, canopus, homelab, etc.)
- Common configuration shared across hosts
- Hardware-specific configurations

b. Module Management Layer
- NixOS System Modules
- Home Manager Modules
- Desktop Environment Configurations

c. Package Management Layer
- Custom packages
- Overlays
- Third-party integrations

**┌─ Infrastructure Layer ─────────────────────┐**
- ┌─────────┐ ┌─────────┐ ┌─────────────┐   │
- Desktop │ │ Servers │ │ VPS Systems │   │
- ┘ └─────────┘ └─────────────┘   │
- ┘
- ↑               ↑
**┌─ Configuration Layer ───────────────────────┐**
- ┌─────────┐ ┌──────────┐ ┌──────────────┐  │
- Hosts  │ │ Hardware │ │ Home Manager │  │
- ┘ └──────────┘ └──────────────┘  │
- ┘
- ↑               ↑
**┌─ Module Layer ────────────────────────────┐**
- ┌──────────┐ ┌───────────┐ ┌──────────┐  │
- System  │ │  Desktop  │ │ Services │  │
- ┘ └───────────┘ └──────────┘  │
- ┘
- ↑               ↑
**┌─ Package Layer ────────────────────────────┐**
- ┌──────────┐ ┌───────────┐ ┌──────────┐   │
- Custom   │ │ Overlays  │ │  Third   │   │
- Packages │ │           │ │  Party   │   │
- ┘ └───────────┘ └──────────┘   │
- ┘

##### Important Elements to Highlight

a. Host-specific configurations:
- Relationship between different host types (Desktop, Server, VPS)
- Shared configurations vs. host-specific ones

b. Module organization:
- Separation between NixOS and Home Manager modules
- Desktop environment configurations (AwesomeWM, etc.)
- Service modules (monitoring, virtualisation, etc.)

c. Package management:
- Custom package definitions (nvim, awesome, etc.)
- Overlay system
- Third-party integrations

##### Connection Types

- Double lines for data flow

##### Notes for Implementation

- Version control integration points
- Build and deployment paths
- Configuration inheritance patterns

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef infrastructure fill:#b3d9ff,stroke:#333
    classDef config fill:#90EE90,stroke:#333
    classDef module fill:#FFB366,stroke:#333
    classDef package fill:#DDA0DD,stroke:#333
    classDef service fill:#FF6B6B,stroke:#333
    classDef common fill:#E0E0E0,stroke:#333
    classDef desktop fill:#98FB98,stroke:#333

    %% Infrastructure Layer
    subgraph InfrastructureLayer["Infrastructure Layer"]
        Desktop["Desktop Systems"]:::infrastructure
        Servers["Server Systems"]:::infrastructure
        VPS["VPS Systems"]:::infrastructure
    end

    %% Configuration Layer
    subgraph ConfigLayer["Configuration Layer"]
        HostConfig["Host Configurations"]:::config
        HardwareConfig["Hardware Configurations"]:::config
        HomeManager["Home Manager"]:::config
        CommonConfig["Common Configurations"]:::config
    end

    %% Module Layer
    subgraph ModuleLayer["Module Layer"]
        NixOSModules["NixOS Modules"]:::module
        HMModules["Home Manager Modules"]:::module
        DesktopEnv["Desktop Environment"]:::module
        Services["Services"]:::module
    end

    %% Package Layer
    subgraph PackageLayer["Package Layer"]
        CustomPkgs["Custom Packages"]:::package
        Overlays["Overlays"]:::package
        ThirdParty["Third Party"]:::package
    end

    %% Desktop Components
    subgraph DesktopComponents["Desktop Components"]
        Awesome["AwesomeWM"]:::desktop
        Hyprland["Hyprland"]:::desktop
        Rofi["Rofi"]:::desktop
        Waybar["Waybar"]:::desktop
    end

    %% Service Components
    subgraph ServiceComponents["Service Components"]
        Monitoring["Monitoring Stack"]:::service
        Virtualization["Virtualization"]:::service
        Security["Security"]:::service
        Database["Database"]:::service
    end

    %% Relationships
    InfrastructureLayer --> ConfigLayer
    ConfigLayer --> ModuleLayer
    ModuleLayer --> PackageLayer
    
    DesktopEnv --> DesktopComponents
    Services --> ServiceComponents

    %% Click Events
    click Desktop "https://github.com/0xTux/nixos-config/tree/main/hosts/sirius/"
    click Servers "https://github.com/0xTux/nixos-config/tree/main/hosts/homelab/"
    click VPS "https://github.com/0xTux/nixos-config/tree/main/hosts/vps/"
    click HostConfig "https://github.com/0xTux/nixos-config/tree/main/hosts/"
    click CommonConfig "https://github.com/0xTux/nixos-config/tree/main/hosts/common/"
    click HardwareConfig "https://github.com/0xTux/nixos-config/blob/main/hosts/*/hardware.nix"
    click NixOSModules "https://github.com/0xTux/nixos-config/tree/main/modules/nixos/"
    click HMModules "https://github.com/0xTux/nixos-config/tree/main/modules/home-manager/"
    click DesktopEnv "https://github.com/0xTux/nixos-config/tree/main/modules/nixos/desktop/"
    click CustomPkgs "https://github.com/0xTux/nixos-config/tree/main/pkgs/"
    click Overlays "https://github.com/0xTux/nixos-config/tree/main/overlays/"
    click Awesome "https://github.com/0xTux/nixos-config/tree/main/modules/home-manager/desktop/awesome/"
    click Hyprland "https://github.com/0xTux/nixos-config/tree/main/modules/home-manager/desktop/hyprland/"
    click Rofi "https://github.com/0xTux/nixos-config/tree/main/modules/home-manager/desktop/rofi/"
    click Waybar "https://github.com/0xTux/nixos-config/tree/main/modules/home-manager/desktop/waybar/"
    click Monitoring "https://github.com/0xTux/nixos-config/tree/main/modules/nixos/monitoring/"
    click Virtualization "https://github.com/0xTux/nixos-config/tree/main/modules/nixos/virtualisation/"
    click Security "https://github.com/0xTux/nixos-config/blob/main/modules/nixos/fail2ban.nix"
    click Database "https://github.com/0xTux/nixos-config/blob/main/modules/nixos/postgresql.nix"
```
