# nazarewk-iac/nix-configs architecture

> Architecture diagram of the GitHub repository nazarewk-iac/nix-configs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nazarewk-iac/nix-configs
- Repository: https://github.com/nazarewk-iac/nix-configs

## Overview

##### Main Components

a. Core System Components:
- NixOS Base System
- Home Manager Integration
- Hardware Management Layer
- User Profiles
- Machine Profiles
- Security Layer

b. Module Categories:
- Desktop Environments (Sway, KDE)
- Development Tools
- Hardware Support
- Networking
- Security
- Virtualisation
- Services

**┌─ User Interface Layer ─────────────────────┐**
- Desktop Environments (Sway/KDE)          │
- Applications                             │
- User Tools                              │
- Configuration Management Layer ───────────┤
- Home Manager                            │
- User Profiles                           │
- Machine Profiles                        │
- Core System Layer ────────────────────────┤
- NixOS Base                              │
- Hardware Support                        │
- Security (LUKS, ZFS)                    │
- Networking                              │
- ┘

##### Key Elements to Highlight

a. System Configuration Flow:
- How configurations flow from flake.nix through modules
- Relationship between machine profiles and user profiles
- Demonstrate how hardware configurations are applied

b. Security Architecture:
- Disk encryption (LUKS + ZFS) setup
- YubiKey/TPM integration
- Secret management

c. Development Environment:
- Language-specific tooling
- IDE integrations
- Container support

##### Implementation Details

- Use standardized symbols for different types of components
- Maintain clear separation between layers
- Configuration inheritance paths
- Optional vs. required components

##### Additional Documentation

- Installation Flow
- Boot Process
- Configuration Application Process
- Secret Management Flow

This design will help developers understand how the various components interact and how to extend the system with new functionality while maintaining its organized structure.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef core fill:#b3d9ff,stroke:#333
    classDef user fill:#90EE90,stroke:#333
    classDef hardware fill:#FFB366,stroke:#333
    classDef security fill:#DDA0DD,stroke:#333
    classDef dev fill:#FFFF99,stroke:#333
    classDef external fill:#D3D3D3,stroke:#333

    %% Main Configuration
    MainConfig["flake.nix"]:::core
    click MainConfig "https://github.com/nazarewk-iac/nix-configs/blob/main/flake.nix"

    %% Core System Layer
    subgraph CoreSystem["Core System Layer"]
        NixOS["NixOS Base System"]:::core
        click NixOS "https://github.com/nazarewk-iac/nix-configs/blob/main/modules/nix.nix"
        HomeManager["Home Manager"]:::core
        click HomeManager "https://github.com/nazarewk-iac/nix-configs/blob/main/modules/home-manager.nix"
        LibFunctions["Library Functions"]:::core
        click LibFunctions "https://github.com/nazarewk-iac/nix-configs/tree/main/lib/"
    end

    %% Configuration Management Layer
    subgraph ConfigManagement["Configuration Management Layer"]
        UserProfiles["User Profiles"]:::user
        click UserProfiles "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/profile/user/"
        MachineProfiles["Machine Profiles"]:::user
        click MachineProfiles "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/profile/machine/"
        ProfileConfigs["Profile Configurations"]:::user
        click ProfileConfigs "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/profile/"
    end

    %% Hardware Layer
    subgraph HardwareLayer["Hardware Layer"]
        HardwareManagement["Hardware Management"]:::hardware
        click HardwareManagement "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/hardware/"
        Audio["Audio"]:::hardware
        click Audio "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/hardware/audio/"
        Bluetooth["Bluetooth"]:::hardware
        click Bluetooth "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/hardware/bluetooth/"
        GPU["GPU"]:::hardware
        click GPU "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/hardware/gpu/"
        CPU["CPU"]:::hardware
        click CPU "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/hardware/cpu/"
        YubiKey["YubiKey"]:::hardware
        click YubiKey "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/hardware/yubikey/"
    end

    %% Security Layer
    subgraph SecurityLayer["Security Layer"]
        Security["Security Components"]:::security
        click Security "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/security/"
        DiskEncryption["Disk Encryption"]:::security
        click DiskEncryption "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/security/disk-encryption/"
        SecretsManagement["Secrets Management"]:::security
        click SecretsManagement "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/security/secrets/"
        SecureBoot["Secure Boot"]:::security
        click SecureBoot "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/security/secure-boot/"
    end

    %% Development Layer
    subgraph DevLayer["Development Layer"]
        DevTools["Development Tools"]:::dev
        click DevTools "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/development/"
        Python["Python"]:::dev
        click Python "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/development/python/"
        NodeJS["Node.js"]:::dev
        click NodeJS "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/development/nodejs/"
        Java["Java"]:::dev
        click Java "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/development/java/"
        Rust["Rust"]:::dev
        click Rust "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/development/rust/"
        Go["Go"]:::dev
        click Go "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/development/golang/"
    end

    %% Desktop Environment Layer
    subgraph DesktopLayer["Desktop Environment Layer"]
        BaseDesktop["Base Desktop"]:::user
        click BaseDesktop "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/desktop/base/"
        Sway["Sway"]:::user
        click Sway "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/desktop/sway/"
        KDE["KDE"]:::user
        click KDE "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/desktop/kde/"
    end

    %% System Components
    subgraph SystemComponents["System Components"]
        Filesystem["Filesystem Management"]:::core
        click Filesystem "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/filesystems/"
        Networking["Networking"]:::core
        click Networking "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/networking/"
        Virtualization["Virtualization"]:::core
        click Virtualization "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/virtualisation/"
        Services["Services"]:::core
        click Services "https://github.com/nazarewk-iac/nix-configs/tree/main/modules/services/"
    end

    %% Relationships
    MainConfig --> CoreSystem
    MainConfig --> ConfigManagement
    CoreSystem --> HardwareLayer
    CoreSystem --> SecurityLayer
    ConfigManagement --> DevLayer
    ConfigManagement --> DesktopLayer
    ConfigManagement --> SystemComponents
    SecurityLayer --> HardwareLayer
    DesktopLayer --> SystemComponents

    %% Legend
    subgraph Legend
        CoreComponent["Core Components"]:::core
        UserComponent["User Components"]:::user
        HardwareComponent["Hardware Components"]:::hardware
        SecurityComponent["Security Components"]:::security
        DevComponent["Development Components"]:::dev
        ExternalComponent["External Components"]:::external
    end
```
