# stunkymonkey/nixos architecture

> Architecture diagram of the GitHub repository stunkymonkey/nixos, 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/stunkymonkey/nixos
- Repository: https://github.com/stunkymonkey/nixos

## Overview

##### Main Components

a. Core System Layer:
- Core configuration components from /machines/core/
- Core.nix, network.nix, users.nix, and nix.nix

b. Machine Configurations Layer:
- Each machine should have sub-components showing:
- Hardware configuration
- Network configuration
- System services
- Disk configuration (disko)
- Secrets management (sops-nix)

c. Modules Layer:
- Into three main categories:
- Hardware modules (bluetooth, graphics, sound, etc.)
- Services modules (extensive list of services like gitea, nextcloud, etc.)
- System modules (docker, fonts, kvm, etc.)

d. Profiles Layer:
- Different profile categories:
- Desktop environments (gnome, sway)
- Development profiles
- Media profiles
- System profiles

##### Special Elements

Create dedicated sections for:
- Flake integrations (nixos-generators, disko, sops-nix, nixinate)
- Image generation pipeline
- Secrets management flow
- Deployment workflow

##### Implementation Details

**┌─────────────────────────────────────────────┐**
- Profiles Layer                              │
- (Desktop, Development, Media, System)       │
- ┤
- Modules Layer                               │
- ┌─────────┐ ┌─────────┐ ┌─────────────┐    │
- Hardware │ │Services │ │System        │    │
- ┘ └─────────┘ └─────────────┘    │
- ┤
- Machine Configurations                       │
- ┌────────┐ ┌─────────┐ ┌─────────┐         │
- Newton  │ │Serverle │ │Thinkman │         │
- ┘ └─────────┘ └─────────┘         │
- ┤
- Core System Layer                           │
- (core.nix, network.nix, users.nix)         │
- ┘

##### Technical Details to Highlight

- Relationship between overlays and packages
- Where custom packages (pkgs directory) are integrated
- Points where external flakes are consumed
- Configuration inheritance chain

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef core fill:#2B4C7E,color:white
    classDef machine fill:#45B7D1,color:black
    classDef module fill:#FF8C42,color:black
    classDef profile fill:#8A2BE2,color:white
    classDef service fill:#98FB98,color:black
    classDef hardware fill:#FFA07A,color:black
    classDef system fill:#DDA0DD,color:black
    classDef image fill:#B8860B,color:white

    %% Core System Layer
    subgraph CoreSystem
        Core["Core Config"]:::core
        Network["Network Config"]:::core
        Users["User Config"]:::core
        NixConfig["Nix Config"]:::core
    end

    %% Machine Configurations Layer
    subgraph Machines
        subgraph Newton
            NewtonConfig["Configuration"]:::machine
            NewtonHW["Hardware"]:::machine
            NewtonNet["Network"]:::machine
            NewtonServ["Services"]:::machine
            NewtonDisk["Disko"]:::machine
            NewtonSecrets["Secrets"]:::machine
        end

        subgraph Serverle
            ServerleConfig["Configuration"]:::machine
            ServerleHW["Hardware"]:::machine
            ServerleNet["Network"]:::machine
            ServerleServ["Services"]:::machine
            ServerleDisk["Disko"]:::machine
            ServerleSecrets["Secrets"]:::machine
        end

        subgraph Thinkman
            ThinkmanConfig["Configuration"]:::machine
            ThinkmanHW["Hardware"]:::machine
            ThinkmanNet["Network"]:::machine
            ThinkmanServ["Services"]:::machine
            ThinkmanDisk["Disko"]:::machine
            ThinkmanSecrets["Secrets"]:::machine
        end
    end

    %% Modules Layer
    subgraph Modules
        subgraph HardwareModules
            Bluetooth["Bluetooth"]:::hardware
            Graphics["Graphics"]:::hardware
            Sound["Sound"]:::hardware
            Yubikey["Yubikey"]:::hardware
        end

        subgraph ServicesModules
            Gitea["Gitea"]:::service
            Nextcloud["Nextcloud"]:::service
            Nginx["Nginx"]:::service
            SSHServer["SSH Server"]:::service
        end

        subgraph SystemModules
            Docker["Docker"]:::system
            KVM["KVM"]:::system
            Fonts["Fonts"]:::system
            Podman["Podman"]:::system
        end
    end

    %% Profiles Layer
    subgraph Profiles
        GnomeProfile["Gnome"]:::profile
        SwayProfile["Sway"]:::profile
        DevProfile["Development"]:::profile
        MediaProfile["Media"]:::profile
        GamingProfile["Gaming"]:::profile
        DesktopDevProfile["Desktop Dev"]:::profile
    end

    %% Image Generation
    subgraph Images
        BaseConfig["Base Config"]:::image
        RPi4Image["RPi4 Image"]:::image
        YubikeyInstaller["Yubikey Installer"]:::image
    end

    %% Relationships
    Core --> NewtonConfig & ServerleConfig & ThinkmanConfig
    Network --> NewtonNet & ServerleNet & ThinkmanNet
    Users --> NewtonConfig & ServerleConfig & ThinkmanConfig
    NixConfig --> NewtonConfig & ServerleConfig & ThinkmanConfig

    %% Click events for component mapping
    click Core "https://github.com/Stunkymonkey/nixos/blob/master/machines/core/core.nix"
    click Network "https://github.com/Stunkymonkey/nixos/blob/master/machines/core/network.nix"
    click Users "https://github.com/Stunkymonkey/nixos/blob/master/machines/core/users.nix"
    click NixConfig "https://github.com/Stunkymonkey/nixos/blob/master/machines/core/nix.nix"
    
    click NewtonConfig "https://github.com/Stunkymonkey/nixos/blob/master/machines/newton/configuration.nix"
    click NewtonHW "https://github.com/Stunkymonkey/nixos/blob/master/machines/newton/hardware-configuration.nix"
    click NewtonNet "https://github.com/Stunkymonkey/nixos/blob/master/machines/newton/network.nix"
    click NewtonServ "https://github.com/Stunkymonkey/nixos/blob/master/machines/newton/services.nix"
    click NewtonDisk "https://github.com/Stunkymonkey/nixos/blob/master/machines/newton/disko-config.nix"
    click NewtonSecrets "https://github.com/Stunkymonkey/nixos/blob/master/machines/newton/secrets.yaml"
    
    click ServerleConfig "https://github.com/Stunkymonkey/nixos/blob/master/machines/serverle/configuration.nix"
    click ServerleHW "https://github.com/Stunkymonkey/nixos/blob/master/machines/serverle/hardware-configuration.nix"
    click ServerleNet "https://github.com/Stunkymonkey/nixos/blob/master/machines/serverle/network.nix"
    click ServerleServ "https://github.com/Stunkymonkey/nixos/blob/master/machines/serverle/services.nix"
    click ServerleDisk "https://github.com/Stunkymonkey/nixos/blob/master/machines/serverle/disko-config.nix"
    click ServerleSecrets "https://github.com/Stunkymonkey/nixos/blob/master/machines/serverle/secrets.yaml"
    
    click ThinkmanConfig "https://github.com/Stunkymonkey/nixos/blob/master/machines/thinkman/configuration.nix"
    click ThinkmanHW "https://github.com/Stunkymonkey/nixos/blob/master/machines/thinkman/hardware-configuration.nix"
    click ThinkmanNet "https://github.com/Stunkymonkey/nixos/blob/master/machines/thinkman/network.nix"
    click ThinkmanServ "https://github.com/Stunkymonkey/nixos/blob/master/machines/thinkman/services.nix"
    click ThinkmanDisk "https://github.com/Stunkymonkey/nixos/blob/master/machines/thinkman/disko-config.nix"
    click ThinkmanSecrets "https://github.com/Stunkymonkey/nixos/blob/master/machines/thinkman/secrets.yaml"
    
    click Bluetooth "https://github.com/Stunkymonkey/nixos/tree/master/modules/hardware/bluetooth"
    click Graphics "https://github.com/Stunkymonkey/nixos/tree/master/modules/hardware/graphics"
    click Sound "https://github.com/Stunkymonkey/nixos/tree/master/modules/hardware/sound"
    click Yubikey "https://github.com/Stunkymonkey/nixos/tree/master/modules/hardware/yubikey"
    
    click Gitea "https://github.com/Stunkymonkey/nixos/tree/master/modules/services/gitea"
    click Nextcloud "https://github.com/Stunkymonkey/nixos/tree/master/modules/services/nextcloud"
    click Nginx "https://github.com/Stunkymonkey/nixos/tree/master/modules/services/nginx"
    click SSHServer "https://github.com/Stunkymonkey/nixos/tree/master/modules/services/ssh-server"
    
    click Docker "https://github.com/Stunkymonkey/nixos/tree/master/modules/system/docker"
    click KVM "https://github.com/Stunkymonkey/nixos/tree/master/modules/system/kvm"
    click Fonts "https://github.com/Stunkymonkey/nixos/tree/master/modules/system/fonts"
    click Podman "https://github.com/Stunkymonkey/nixos/tree/master/modules/system/podman"
    
    click GnomeProfile "https://github.com/Stunkymonkey/nixos/tree/master/profiles/gnome"
    click SwayProfile "https://github.com/Stunkymonkey/nixos/tree/master/profiles/sway"
    click DevProfile "https://github.com/Stunkymonkey/nixos/tree/master/profiles/development"
    click MediaProfile "https://github.com/Stunkymonkey/nixos/tree/master/profiles/media"
    click GamingProfile "https://github.com/Stunkymonkey/nixos/tree/master/profiles/gaming"
    click DesktopDevProfile "https://github.com/Stunkymonkey/nixos/tree/master/profiles/desktop-dev"
    
    click BaseConfig "https://github.com/Stunkymonkey/nixos/blob/master/images/base-config.nix"
    click RPi4Image "https://github.com/Stunkymonkey/nixos/blob/master/images/rpi4-image.nix"
    click YubikeyInstaller "https://github.com/Stunkymonkey/nixos/blob/master/images/yubikey-installer.nix"
```
