# ryan4yin/nix-config architecture

> Architecture diagram of the GitHub repository ryan4yin/nix-config, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ryan4yin/nix-config
- Repository: https://github.com/ryan4yin/nix-config

## Overview

This repository is a personal Nix flake configuration for NixOS desktops and servers, plus macOS desktops. The main workflow is to select a configured host, compose its system and shared Home Manager settings into a flake output, then deploy that output. The README also documents server VMs, a K3s test cluster, self-hosted services, secrets, and application hardening. The graph follows those documented boundaries; implementation excerpts for the flake and host modules were not provided, so internal composition links are marked unverified.

Main entry points: [`hosts`](https://github.com/ryan4yin/nix-config/tree/main/hosts) (Host Configurations), [`outputs`](https://github.com/ryan4yin/nix-config/tree/main/outputs) (Flake Outputs), [`home/base`](https://github.com/ryan4yin/nix-config/tree/main/home/base) (Shared Home Config), [`modules/nixos`](https://github.com/ryan4yin/nix-config/tree/main/modules/nixos) (NixOS Modules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["System Configuration"]
  node_host_inventory["Host Configurations"]
  node_nixos_modules["NixOS Modules"]
  node_darwin_modules["Darwin Modules"]
end

subgraph group_user["User Environments"]
  node_home_shared["Shared Home Config"]
  node_home_linux["Linux Home Config"]
  node_home_darwin["macOS Home Config"]
  node_host_home["Host Home Settings"]
end

subgraph group_services["Services and Security"]
  node_homelab["Homelab Services"]
  node_hardening["Application Hardening"]
  node_secrets["Secret Configuration"]
end

subgraph group_delivery["Flake and Deployment"]
  node_flake_outputs["Flake Outputs"]
  node_deployment["System Deployment"]
end

node_operator(("System Maintainer"))
node_private_secrets[("Private Secrets Repo")]

node_operator -->|"chooses host"| node_host_inventory
node_host_inventory -.->|"composed as outputs"| node_flake_outputs
node_nixos_modules -.->|"included in outputs"| node_flake_outputs
node_darwin_modules -.->|"included in outputs"| node_flake_outputs
node_home_shared -->|"shared with"| node_home_linux
node_home_shared -->|"shared with"| node_home_darwin
node_host_home -.->|"customizes hosts"| node_home_shared
node_homelab -->|"configures server"| node_host_inventory
node_hardening -->|"hardens systems"| node_host_inventory
node_private_secrets -->|"supplies secrets"| node_secrets
node_operator -->|"deploys flake"| node_deployment
node_flake_outputs -->|"selects configuration"| node_deployment

click node_host_inventory "https://github.com/ryan4yin/nix-config/tree/main/hosts"
click node_nixos_modules "https://github.com/ryan4yin/nix-config/tree/main/modules/nixos"
click node_darwin_modules "https://github.com/ryan4yin/nix-config/tree/main/modules/darwin"
click node_home_shared "https://github.com/ryan4yin/nix-config/tree/main/home/base"
click node_home_linux "https://github.com/ryan4yin/nix-config/tree/main/home/linux"
click node_home_darwin "https://github.com/ryan4yin/nix-config/tree/main/home/darwin"
click node_host_home "https://github.com/ryan4yin/nix-config/tree/main/home/hosts"
click node_homelab "https://github.com/ryan4yin/nix-config/tree/main/hosts/12kingdoms-youko/homelab-services"
click node_hardening "https://github.com/ryan4yin/nix-config/tree/main/hardening"
click node_secrets "https://github.com/ryan4yin/nix-config/tree/main/secrets"
click node_flake_outputs "https://github.com/ryan4yin/nix-config/tree/main/outputs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_host_inventory,node_nixos_modules,node_darwin_modules toneBlue
class node_home_shared,node_home_linux,node_home_darwin,node_host_home,node_private_secrets toneAmber
class node_homelab,node_hardening,node_secrets toneMint
class node_flake_outputs,node_deployment toneRose
class node_operator toneIndigo
```

## Components

### System Configuration

- [Host Configurations](https://github.com/ryan4yin/nix-config/tree/main/hosts): `hosts`
- [NixOS Modules](https://github.com/ryan4yin/nix-config/tree/main/modules/nixos): `modules/nixos`
- [Darwin Modules](https://github.com/ryan4yin/nix-config/tree/main/modules/darwin): `modules/darwin`

### User Environments

- [Shared Home Config](https://github.com/ryan4yin/nix-config/tree/main/home/base): `home/base`
- [Linux Home Config](https://github.com/ryan4yin/nix-config/tree/main/home/linux): `home/linux`
- [macOS Home Config](https://github.com/ryan4yin/nix-config/tree/main/home/darwin): `home/darwin`
- [Host Home Settings](https://github.com/ryan4yin/nix-config/tree/main/home/hosts): `home/hosts`

### Services and Security

- [Homelab Services](https://github.com/ryan4yin/nix-config/tree/main/hosts/12kingdoms-youko/homelab-services): `hosts/12kingdoms-youko/homelab-services`
- [Application Hardening](https://github.com/ryan4yin/nix-config/tree/main/hardening): `hardening`
- [Secret Configuration](https://github.com/ryan4yin/nix-config/tree/main/secrets): `secrets`

### Flake and Deployment

- [Flake Outputs](https://github.com/ryan4yin/nix-config/tree/main/outputs): `outputs`
- **System Deployment**

### Other components

- **System Maintainer**
- **Private Secrets Repo**

## Connections

- System Maintainer → Host Configurations: chooses host (evidence: `README.md`)
- Host Configurations → Flake Outputs: composed as outputs
- NixOS Modules → Flake Outputs: included in outputs
- Darwin Modules → Flake Outputs: included in outputs
- Shared Home Config → Linux Home Config: shared with (evidence: `README.md`)
- Shared Home Config → macOS Home Config: shared with (evidence: `README.md`)
- Host Home Settings → Shared Home Config: customizes hosts
- Homelab Services → Host Configurations: configures server (evidence: `README.md`)
- Application Hardening → Host Configurations: hardens systems (evidence: `README.md`)
- Private Secrets Repo → Secret Configuration: supplies secrets (evidence: `README.md`)
- System Maintainer → System Deployment: deploys flake (evidence: `README.md`)
- Flake Outputs → System Deployment: selects configuration (evidence: `README.md`)
