# minegameytb/glf-os architecture

> Architecture diagram of the GitHub repository minegameytb/glf-os, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/minegameytb/glf-os
- Repository: https://github.com/minegameytb/glf-os

## Overview

##### Main Components
- Build System & Tooling:
- Nix flake (flake.nix and flake.lock): This is the core of the build process.
- Justfile: A task runner that wraps multiple operations (ISO building, install, cleaning, checking, and VM testing).
- GitHub workflows in .github/workflows: These automate builds (e.g., nix-build) and pages deployment.
- Configuration Layers:
- Standard NixOS modules (modules/default): Contains individual configuration elements (firefox, nvidia, gaming, etc.) using a modular, declarative approach.
- ISO Specific configuration (iso-cfg): Holds configuration files and custom configurations specific to the ISO build.
- Patches (patches/calamares-nixos-extensions): Contains extensions or modifications to the installer components.
- Custom Packages (pkgs): For example, GLFfetch is specified here.
- Documentation & Assets:
- docs directory: Contains documentation pages (in Markdown) and configuration for the static site (using Jekyll or similar) including custom styles and images.
- assets: Contains media files such as wallpapers.
- Testing & Validation:
- Just commands (just check, just build, just build-vm): These interact with the configuration to perform syntax checking, configuration build caching, and VM-based testing of the ISO.

##### Relationships and Interactions
- The Nix flake serves as the unified entry point to the configuration by aggregating modules, patches, and ISO specific configurations.
- The Justfile orchestrates sequential operations:
- It triggers the ISO build (via nix build .#iso) and installation (which copies the generated ISO and creates a hash file).
- It launches testing (syntax checks and building configurations without generating an ISO) and VM testing.
- GitHub workflows further extend this by automating flavor-specific builds (nix builds, pages updates, etc.) and ensuring the repository’s continuous integration and delivery.
- The modules layer interacts with both the ISO configuration and the patches to customize the NixOS system installation.
- Documentation (docs, assets) and versioning (LICENSE, README) support user and developer guidance.

##### Architectural Patterns and Technologies
- Declarative Configuration Pattern: NixOS configurations are highly modular and declarative. Components are expressed in Nix language files (default.nix, system.nix, etc.) that are composed to generate the final system configuration.
- Flake-based Build: Centralized build control via the flake.nix, facilitating reproducible builds.
- Task Orchestration & Automation: Use of a Justfile to define a set of repeatable operations (build, install, clean, check, etc.).
- Continuous Integration / Continuous Deployment: GitHub workflows automate tests and builds, ensuring that changes to modules or configurations build correctly.
- Customization via Patches: The patches directory shows an architecture that supports customizing external components (i.e., Calamares installer modifications).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Build System & CI/CD"
        NF["Nix Flake"]:::build
        JT["Just Task Runner"]:::build
        GH["GitHub Workflows"]:::build
    end

    subgraph "Configuration Layers"
        NM["NixOS Modules"]:::config
        IC["ISO Configuration"]:::config
        PP["Patches"]:::config
        CP["Custom Packages"]:::config
    end

    subgraph "Documentation & Assets"
        DOCS["Docs"]:::docs
        ASSETS["Assets"]:::docs
    end

    TV["Testing & Validation (Just check/build-vm)"]:::test
    ISO["ISO Image"]:::artifact

    NM --> NF
    IC --> NF
    PP --> NF
    CP --> NF

    GH --> NF
    GH --> JT
    NF --> JT

    JT -->|"buildISO"| ISO
    JT --> TV
    GH --> TV

    NF -->|"includesDocumentation"| DOCS

    %% Click Events
    click NF "https://github.com/minegameytb/glf-os/blob/dev/flake.nix"
    click JT "https://github.com/minegameytb/glf-os/tree/dev/Justfile"
    click GH "https://github.com/minegameytb/glf-os/tree/dev/.github/workflows"
    click NM "https://github.com/minegameytb/glf-os/tree/dev/modules/default"
    click IC "https://github.com/minegameytb/glf-os/tree/dev/iso-cfg"
    click PP "https://github.com/minegameytb/glf-os/tree/dev/patches/calamares-nixos-extensions"
    click CP "https://github.com/minegameytb/glf-os/tree/dev/pkgs"
    click DOCS "https://github.com/minegameytb/glf-os/tree/dev/docs"
    click ASSETS "https://github.com/minegameytb/glf-os/tree/dev/assets"

    %% Styles
    classDef build fill:#d1e5f0,stroke:#1f78b4,stroke-width:2px;
    classDef config fill:#fde0dd,stroke:#c51b7d,stroke-width:2px;
    classDef test fill:#d9f0d3,stroke:#31a354,stroke-width:2px;
    classDef docs fill:#fff7bc,stroke:#fdae61,stroke-width:2px;
    classDef artifact fill:#e0f3f8,stroke:#99d8c9,stroke-width:2px;
```
