# frost-phoenix/nixos-config architecture

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

- Interactive diagram: https://gitdiagram.com/frost-phoenix/nixos-config
- Repository: https://github.com/frost-phoenix/nixos-config

## Overview

##### Main Components
- Flake Base: At the root is the flake.nix file which acts as the entry point that ties together all configurations.
- Hosts: The “hosts” directory contains per-host configurations for desktops, laptops, and VMs. These represent the hardware-specific customization that adapts the core configuration to different machines.
- Modules: The “modules” folder splits into:
- Core Modules: Located in modules/core, these files (e.g., system.nix, network.nix, services.nix, etc.) configure the essential NixOS system settings and services.
- Home Modules: In modules/home, you have your Home Manager configuration files along with application-specific settings (e.g., configurations for Discord, Neovim, Waybar, etc.) and custom scripts.
- Packages: The “pkgs” folder shows custom package definitions such as for applications like 2048 or monolisa. This is how custom builds are incorporated.
- Additional Assets: The wallpapers, shell scripts, and keybinds establish the user experience on the system.
- Installation Script: The install.sh is a critical automation component that adapts usernames, copies hardware configs, and organizes user directories.

##### Relationships and Interactions
- Under Modules, create two branches:
- Core (for NixOS system-level configurations such as network, hardware, security, and services).
- Home (for user-level configurations provided by Home Manager, including applications, shell customizations, and scripts).
- That the PKGS feed into the system’s build process by drawing a link from flake.nix (or a “Packages” module) to these custom package definitions.
- A component for the installation script (install.sh) that interacts with both the user environment (fixing up directories and wallpapers) and the host configurations (copying hardware configurations).

##### Architectural Patterns and Design Principles
- Modularity: Emphasize that the configuration is divided into well-separated modules (core vs. home) which follow a clear separation of concerns.
- Multi-Host Specificity: Illustrate how common configurations are parameterized by host—desktop vs. laptop vs. VM—to signal adaptability and reusability.
- Declarative Infrastructure as Code: Nix flakes and Home Manager enforce a declarative style that ensures reproducibility.
- Extensibility: The structured use of directories (modules, pkgs) allows new components or configurations to be easily added.

##### Relevant Technologies and Frameworks
- NixOS and Nix Flakes (central to the configuration management).
- Home Manager (for user environment customization).
- Custom scripts for additional system behavior (keybindings, wallpaper picker, and utility scripts).
- Third-party applications such as Hyprland, Waybar, rofi, and more as defined in the README are the end tools configured by this setup.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Flake Base"]:::flake

    subgraph "Host Configurations"
        B1["Desktop"]:::hosts
        B2["Laptop"]:::hosts
        B3["VM"]:::hosts
    end

    subgraph "Modules"
        C1["Core Modules"]:::modules
        C2["Home Modules"]:::modules
    end

    D["Custom Package Definitions"]:::packages
    E["Installation Script"]:::installer
    F["Additional Assets"]:::assets

    %% Flake Base includes configurations
    A -->|"includes"| B1
    A -->|"includes"| B2
    A -->|"includes"| B3
    A -->|"includes"| C1
    A -->|"includes"| C2
    A -->|"includes"| D

    %% Installation script interacts with host configurations and user assets
    E -->|"updates"| B1
    E -->|"updates"| B2
    E -->|"updates"| B3
    E -->|"customizes"| F

    %% Home Modules manage user-level assets
    C2 -->|"manages"| F

    %% Click Events
    click A "https://github.com/frost-phoenix/nixos-config/blob/main/flake.nix"
    click B1 "https://github.com/frost-phoenix/nixos-config/tree/main/hosts/desktop"
    click B2 "https://github.com/frost-phoenix/nixos-config/tree/main/hosts/laptop"
    click B3 "https://github.com/frost-phoenix/nixos-config/tree/main/hosts/vm"
    click C1 "https://github.com/frost-phoenix/nixos-config/tree/main/modules/core/"
    click C2 "https://github.com/frost-phoenix/nixos-config/tree/main/modules/home/"
    click D "https://github.com/frost-phoenix/nixos-config/tree/main/pkgs/"
    click E "https://github.com/frost-phoenix/nixos-config/blob/main/install.sh"
    click F "https://github.com/frost-phoenix/nixos-config/tree/main/wallpapers/"

    %% Styles
    classDef flake fill:#A4DE02,stroke:#333,stroke-width:2px,color:#000;
    classDef hosts fill:#89CFF0,stroke:#333,stroke-width:2px,color:#000;
    classDef modules fill:#FFA07A,stroke:#333,stroke-width:2px,color:#000;
    classDef packages fill:#DDA0DD,stroke:#333,stroke-width:2px,color:#000;
    classDef installer fill:#F0E68C,stroke:#333,stroke-width:2px,color:#000;
    classDef assets fill:#98FB98,stroke:#333,stroke-width:2px,color:#000;
```
