# bad3r/nixos architecture

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

- Interactive diagram: https://gitdiagram.com/bad3r/nixos
- Repository: https://github.com/bad3r/nixos

## Overview

This repository is a NixOS configuration, with a collection of supporting runtime packages and host tools. The README describes automatic module discovery, host/app wiring, storage boundaries, cache policy, and secrets; the supplied tree does not include the Nix module sources needed to trace those configuration flows. The graph therefore focuses on runtime packages whose workflows are supported by the excerpts and SOURCE INDEX, and includes the documented configuration boundary as a separate capability. Unsampled relationships are omitted.

Main entry points: [`packages/sbx/sbx/lifecycle.py`](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/lifecycle.py) (Sandbox lifecycle), [`packages/browser-fetch/browser_fetch/fetch.py`](https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/fetch.py) (Fetch orchestration), [`packages/browser-fetch/browser_fetch/browser.py`](https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/browser.py) (Browser session), [`packages/kagi-search/kagi_search/client.py`](https://github.com/bad3r/nixos/blob/main/packages/kagi-search/kagi_search/client.py) (Kagi search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web retrieval"]
  node_bfcli["Fetch CLI<br/>[cli.py]"]
  node_bffetch["Fetch orchestration<br/>[fetch.py]"]
  node_browser["Browser session<br/>[browser.py]"]
  node_session["Browser runtime<br/>[session.py]"]
  node_curl["Impersonated HTTP<br/>[curl.py]"]
  node_cookies[("Cookie jar<br/>[cookies.py]")]
  node_kagi["Kagi search<br/>[client.py]"]
  node_page["Result parsing<br/>[page.py]"]
end

subgraph group_sandbox["Sandbox execution"]
  node_sbxcli["Sandbox CLI<br/>[cli.py]"]
  node_pipeline["One-shot runs<br/>[pipeline.py]"]
  node_lifecycle["Sandbox lifecycle<br/>[lifecycle.py]"]
  node_transfer["File transfer<br/>[transfer.py]"]
  node_model["Sandbox model<br/>[model.py]"]
  node_context["Runtime context<br/>[context.py]"]
  node_results["Run results<br/>[results.py]"]
  node_storage["Run storage<br/>[storage.py]"]
  node_vmbackend["Virtual machine backend<br/>[backend.py]"]
end

subgraph group_hosttools["Host utilities"]
  node_grantd["Workload grant service<br/>[grantd.py]"]
  node_grants["Grant policy<br/>[grants.py]"]
  node_vsock["Vsock transport<br/>[vsock.py]"]
  node_warpcli["Device CLI<br/>[cli.py]"]
  node_warpapi["Device API<br/>[api.py]"]
  node_devices["Device operations<br/>[devices.py]"]
  node_history["Device history<br/>[history.py]"]
  node_updater["Updater library<br/>[__init__.py]"]
  node_bootstrap["Updater bootstrap"]
end

subgraph group_config["System configuration"]
  node_modules["Discovered Nix modules"]
  node_hostpolicy["Host and app policy"]
  node_secrets["Secret declarations"]
end

node_user(("User / operator"))
node_kagiuser(("Search user"))
node_hostadmin(("Host administrator"))
node_journal[("System journal")]

node_user -->|"invokes"| node_bfcli
node_bfcli -.->|"dispatches"| node_bffetch
node_bffetch -->|"uses browser"| node_browser
node_bffetch -->|"uses HTTP"| node_curl
node_bffetch -->|"uses jar"| node_cookies
node_browser -->|"reads and writes"| node_cookies
node_browser -->|"uses HTTP"| node_curl
node_browser -.->|"runs session"| node_session
node_kagiuser -->|"searches"| node_kagi
node_kagi -->|"checks session"| node_cookies
node_kagi -->|"requests page"| node_curl
node_kagi -->|"parses results"| node_page
node_user -.->|"requests run"| node_sbxcli
node_sbxcli -.->|"dispatches run"| node_pipeline
node_pipeline -->|"creates and destroys"| node_lifecycle
node_pipeline -->|"copies files"| node_transfer
node_lifecycle -->|"uses context"| node_context
node_lifecycle -->|"uses records"| node_model
node_lifecycle -->|"records outcomes"| node_results
node_lifecycle -.->|"uses backend"| node_vmbackend
node_pipeline -->|"returns result"| node_results
node_hostadmin -.->|"requests grants"| node_grantd
node_grantd -->|"uses policy"| node_grants
node_grantd -->|"uses transport"| node_vsock
node_hostadmin -->|"manages devices"| node_warpcli
node_warpcli -->|"calls API"| node_warpapi
node_warpcli -->|"uses operations"| node_devices
node_warpcli -->|"uses history"| node_history
node_hostadmin -.->|"runs updates"| node_updater
node_updater -->|"bootstraps package"| node_bootstrap
node_hostadmin -->|"configures system"| node_modules
node_modules -->|"discovers host policy"| node_hostpolicy
node_modules -->|"declares secrets"| node_secrets
node_hostpolicy -.->|"records runtime events"| node_journal

click node_bfcli "https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/cli.py"
click node_bffetch "https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/fetch.py"
click node_browser "https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/browser.py"
click node_session "https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/session.py"
click node_curl "https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/curl.py"
click node_cookies "https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/cookies.py"
click node_kagi "https://github.com/bad3r/nixos/blob/main/packages/kagi-search/kagi_search/client.py"
click node_page "https://github.com/bad3r/nixos/blob/main/packages/kagi-search/kagi_search/page.py"
click node_sbxcli "https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/cli.py"
click node_pipeline "https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/pipeline.py"
click node_lifecycle "https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/lifecycle.py"
click node_transfer "https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/transfer.py"
click node_model "https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/model.py"
click node_context "https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/context.py"
click node_results "https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/results.py"
click node_storage "https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/storage.py"
click node_vmbackend "https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/backend.py"
click node_grantd "https://github.com/bad3r/nixos/blob/main/packages/workloads/workloads/grantd.py"
click node_grants "https://github.com/bad3r/nixos/blob/main/packages/workloads/workloads/grants.py"
click node_vsock "https://github.com/bad3r/nixos/blob/main/packages/workloads/workloads/vsock.py"
click node_warpcli "https://github.com/bad3r/nixos/blob/main/packages/warp-devices/warp_devices/cli.py"
click node_warpapi "https://github.com/bad3r/nixos/blob/main/packages/warp-devices/warp_devices/api.py"
click node_devices "https://github.com/bad3r/nixos/blob/main/packages/warp-devices/warp_devices/devices.py"
click node_history "https://github.com/bad3r/nixos/blob/main/packages/warp-devices/warp_devices/history.py"
click node_updater "https://github.com/bad3r/nixos/blob/main/scripts/updater/__init__.py"
click node_bootstrap "https://github.com/bad3r/nixos/blob/main/scripts/updater_bootstrap.py"
click node_modules "https://github.com/bad3r/nixos/tree/main/modules"
click node_hostpolicy "https://github.com/bad3r/nixos/tree/main/modules/hosts"
click node_secrets "https://github.com/bad3r/nixos/tree/main/modules"

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_bfcli,node_bffetch,node_browser,node_session,node_curl,node_cookies,node_kagi,node_page,node_user,node_kagiuser toneBlue
class node_sbxcli,node_pipeline,node_lifecycle,node_transfer,node_model,node_context,node_results,node_storage,node_vmbackend,node_journal toneAmber
class node_grantd,node_grants,node_vsock,node_warpcli,node_warpapi,node_devices,node_history,node_updater,node_bootstrap toneMint
class node_modules,node_hostpolicy,node_secrets toneRose
class node_hostadmin toneIndigo
```

## Components

### Web retrieval

- [Fetch CLI](https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/cli.py): `packages/browser-fetch/browser_fetch/cli.py`
- [Fetch orchestration](https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/fetch.py): `packages/browser-fetch/browser_fetch/fetch.py`
- [Browser session](https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/browser.py): `packages/browser-fetch/browser_fetch/browser.py`
- [Browser runtime](https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/session.py): `packages/browser-fetch/browser_fetch/session.py`
- [Impersonated HTTP](https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/curl.py): `packages/browser-fetch/browser_fetch/curl.py`
- [Cookie jar](https://github.com/bad3r/nixos/blob/main/packages/browser-fetch/browser_fetch/cookies.py): `packages/browser-fetch/browser_fetch/cookies.py`
- [Kagi search](https://github.com/bad3r/nixos/blob/main/packages/kagi-search/kagi_search/client.py): `packages/kagi-search/kagi_search/client.py`
- [Result parsing](https://github.com/bad3r/nixos/blob/main/packages/kagi-search/kagi_search/page.py): `packages/kagi-search/kagi_search/page.py`

### Sandbox execution

- [Sandbox CLI](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/cli.py): `packages/sbx/sbx/cli.py`
- [One-shot runs](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/pipeline.py): `packages/sbx/sbx/pipeline.py`
- [Sandbox lifecycle](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/lifecycle.py): `packages/sbx/sbx/lifecycle.py`
- [File transfer](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/transfer.py): `packages/sbx/sbx/transfer.py`
- [Sandbox model](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/model.py): `packages/sbx/sbx/model.py`
- [Runtime context](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/context.py): `packages/sbx/sbx/context.py`
- [Run results](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/results.py): `packages/sbx/sbx/results.py`
- [Run storage](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/storage.py): `packages/sbx/sbx/storage.py`
- [Virtual machine backend](https://github.com/bad3r/nixos/blob/main/packages/sbx/sbx/backend.py): `packages/sbx/sbx/backend.py`

### Host utilities

- [Workload grant service](https://github.com/bad3r/nixos/blob/main/packages/workloads/workloads/grantd.py): `packages/workloads/workloads/grantd.py`
- [Grant policy](https://github.com/bad3r/nixos/blob/main/packages/workloads/workloads/grants.py): `packages/workloads/workloads/grants.py`
- [Vsock transport](https://github.com/bad3r/nixos/blob/main/packages/workloads/workloads/vsock.py): `packages/workloads/workloads/vsock.py`
- [Device CLI](https://github.com/bad3r/nixos/blob/main/packages/warp-devices/warp_devices/cli.py): `packages/warp-devices/warp_devices/cli.py`
- [Device API](https://github.com/bad3r/nixos/blob/main/packages/warp-devices/warp_devices/api.py): `packages/warp-devices/warp_devices/api.py`
- [Device operations](https://github.com/bad3r/nixos/blob/main/packages/warp-devices/warp_devices/devices.py): `packages/warp-devices/warp_devices/devices.py`
- [Device history](https://github.com/bad3r/nixos/blob/main/packages/warp-devices/warp_devices/history.py): `packages/warp-devices/warp_devices/history.py`
- [Updater library](https://github.com/bad3r/nixos/blob/main/scripts/updater/__init__.py): `scripts/updater/__init__.py`
- [Updater bootstrap](https://github.com/bad3r/nixos/blob/main/scripts/updater_bootstrap.py): `scripts/updater_bootstrap.py`

### System configuration

- [Discovered Nix modules](https://github.com/bad3r/nixos/tree/main/modules): `modules`
- [Host and app policy](https://github.com/bad3r/nixos/tree/main/modules/hosts): `modules/hosts`
- [Secret declarations](https://github.com/bad3r/nixos/tree/main/modules): `modules`

### Other components

- **User / operator**
- **Search user**
- **Host administrator**
- **System journal**

## Connections

- User / operator → Fetch CLI: invokes
- Fetch CLI → Fetch orchestration: dispatches
- Fetch orchestration → Browser session: uses browser (evidence: `packages/browser-fetch/browser_fetch/fetch.py`)
- Fetch orchestration → Impersonated HTTP: uses HTTP (evidence: `packages/browser-fetch/browser_fetch/fetch.py`)
- Fetch orchestration → Cookie jar: uses jar (evidence: `packages/browser-fetch/browser_fetch/fetch.py`)
- Browser session → Cookie jar: reads and writes (evidence: `packages/browser-fetch/browser_fetch/browser.py`)
- Browser session → Impersonated HTTP: uses HTTP (evidence: `packages/browser-fetch/browser_fetch/browser.py`)
- Browser session → Browser runtime: runs session (evidence: `packages/browser-fetch/browser_fetch/session.py`)
- Search user → Kagi search: searches (evidence: `packages/kagi-search/kagi_search/client.py`)
- Kagi search → Cookie jar: checks session (evidence: `packages/kagi-search/kagi_search/client.py`)
- Kagi search → Impersonated HTTP: requests page (evidence: `packages/kagi-search/kagi_search/client.py`)
- Kagi search → Result parsing: parses results (evidence: `packages/kagi-search/kagi_search/client.py`)
- User / operator → Sandbox CLI: requests run
- Sandbox CLI → One-shot runs: dispatches run
- One-shot runs → Sandbox lifecycle: creates and destroys (evidence: `packages/sbx/sbx/pipeline.py`)
- One-shot runs → File transfer: copies files (evidence: `packages/sbx/sbx/pipeline.py`)
- Sandbox lifecycle → Runtime context: uses context (evidence: `packages/sbx/sbx/lifecycle.py`)
- Sandbox lifecycle → Sandbox model: uses records (evidence: `packages/sbx/sbx/lifecycle.py`)
- Sandbox lifecycle → Run results: records outcomes (evidence: `packages/sbx/sbx/lifecycle.py`)
- Sandbox lifecycle → Virtual machine backend: uses backend
- One-shot runs → Run results: returns result (evidence: `packages/sbx/sbx/pipeline.py`)
- Host administrator → Workload grant service: requests grants
- Workload grant service → Grant policy: uses policy (evidence: `packages/workloads/workloads/grantd.py`)
- Workload grant service → Vsock transport: uses transport (evidence: `packages/workloads/workloads/grantd.py`)
- Host administrator → Device CLI: manages devices (evidence: `packages/warp-devices/warp_devices/cli.py`)
- Device CLI → Device API: calls API (evidence: `packages/warp-devices/warp_devices/cli.py`)
- Device CLI → Device operations: uses operations (evidence: `packages/warp-devices/warp_devices/cli.py`)
- Device CLI → Device history: uses history (evidence: `packages/warp-devices/warp_devices/cli.py`)
- Host administrator → Updater library: runs updates
- Updater library → Updater bootstrap: bootstraps package (evidence: `packages/brave-origin/update.py`)
- Host administrator → Discovered Nix modules: configures system (evidence: `README.md`)
- Discovered Nix modules → Host and app policy: discovers host policy (evidence: `README.md`)
- Discovered Nix modules → Secret declarations: declares secrets (evidence: `README.md`)
- Host and app policy → System journal: records runtime events
