# vitalbio/dash-haskell-flake architecture

> Architecture diagram of the GitHub repository vitalbio/dash-haskell-flake, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vitalbio/dash-haskell-flake
- Repository: https://github.com/vitalbio/dash-haskell-flake

## Overview

#### Purpose

This is a Nix flake module that adds Dash docset generation to a `haskell-flake` project. It produces Haddock HTML and packages it as a Dash-compatible docset, using Dashing and CSS-selector-based indexing rather than older Haskell-specific generators.

#### Entry Points

- `flake.nix` is the consumable flake entry point. Downstream flakes import its exported `flakeModule` alongside `haskell-flake`.
- `default.nix` is the likely module implementation and compatibility/default Nix entry point.
- `README.md` defines the downstream configuration contract: `dashHaskell` attributes such as package identity, version, project, external URL, and URL mapping script.

#### Flake-Module Integration Boundary

The repository is infrastructure code, not an application. Consumers provide their own `haskellProjects` configuration, then configure `dashHaskell` in the same `perSystem` scope. The module must resolve the selected Haskell project and expose build outputs back through `config.dashHaskell.outputs.default`.

Grounding paths: `flake.nix`, `default.nix`, `README.md`.

#### Documentation Build Stage

The primary input is the configured Haskell package within a named `haskell-flake` project. The module generates or obtains that package’s Haddock documentation as HTML, exposed to consumers as `haddock`.

The README’s expected package export pattern is:

- `config.dashHaskell.outputs.default.haddock`
- `config.dashHaskell.outputs.default.docset`

Grounding paths: `default.nix`, `README.md`.

#### Dash Docset Assembly and Indexing

The module uses the external Dashing package to transform generated documentation into Dash’s docset layout. Search-index entries are derived from CSS selectors targeting Haddock HTML structures: package and module headers, types, constructors, and functions. This avoids relying on stale prior-art Haskell docset packages.

Grounding paths: `default.nix`, `README.md`.

#### URL and Metadata Boundary

Consumer-provided metadata controls docset identity and links:

- `name`, `package`, and `version` identify the generated documentation.
- `externalUrl` points users to the source/project site.
- `mkDocsetUrl` is an executable Nix-produced script that maps a built store path to a downloadable URL, suitable for internal binary-cache or Hydra-style hosting.
- `haskellProject` selects the source project.

Grounding paths: `README.md`, `default.nix`.

#### Runtime and Infrastructure

Build execution is Nix-based, using `nixpkgs`, `flake-parts`, and `srid/haskell-flake`; the exact pinned inputs are expected in `flake.nix`. The docset-generation runtime depends on Dashing. Generated artifacts are Nix derivations and can be published through a Nix cache/build service, as implied by the configurable Hydra URL transformation.

Grounding paths: `flake.nix`, `default.nix`, `README.md`.

Main entry points: [`default.nix`](https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix) (dashHaskell config), [`flake.nix`](https://github.com/vitalbio/dash-haskell-flake/blob/main/flake.nix) (Flake entry), [`README.md`](https://github.com/vitalbio/dash-haskell-flake/blob/main/README.md) (Configuration contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Flake integration"]
  node_consumer["Downstream flake<br/>consumer configuration"]
  node_flake["Flake entry<br/>flake export<br/>[flake.nix]"]
  node_module["Dash Haskell module<br/>Nix module<br/>[default.nix]"]
  node_readme["Configuration contract<br/>documentation<br/>[README.md]"]
  node_nix_inputs["Nix build inputs<br/>[flake.nix]"]
  node_dash_config["dashHaskell config<br/>module options<br/>[default.nix]"]
end

subgraph group_build["Documentation pipeline"]
  node_haskell_project["Selected Haskell project<br/>haskell-flake project"]
  node_package["Configured package<br/>Haskell package"]
  node_haddock["Haddock HTML<br/>Nix derivation<br/>[default.nix]"]
  node_dashing["Dashing<br/>docset builder<br/>[default.nix]"]
  node_css_index["Haddock selector index<br/>CSS indexing rules<br/>[default.nix]"]
end

subgraph group_outputs["Published outputs"]
  node_docset["Dash docset<br/>Nix derivation<br/>[default.nix]"]
  node_default_output["outputs.default<br/>module output<br/>[default.nix]"]
  node_publication["Cache or Hydra hosting<br/>artifact publication"]
end

node_consumer -->|"imports flakeModule"| node_flake
node_flake -->|"exports"| node_module
node_flake -->|"pins"| node_nix_inputs
node_readme -.->|"documents"| node_dash_config
node_consumer -->|"configures"| node_dash_config
node_module -->|"defines"| node_dash_config
node_dash_config -->|"selects"| node_haskell_project
node_haskell_project -->|"provides"| node_package
node_package -->|"generates"| node_haddock
node_haddock -->|"HTML input"| node_dashing
node_css_index -->|"index selectors"| node_dashing
node_dash_config -->|"metadata and URLs"| node_dashing
node_dashing -->|"assembles"| node_docset
node_haddock -->|"exports as haddock"| node_default_output
node_docset -->|"exports as docset"| node_default_output
node_dash_config -->|"mkDocsetUrl"| node_publication
node_docset -.->|"published artifact"| node_publication

click node_flake "https://github.com/vitalbio/dash-haskell-flake/blob/main/flake.nix"
click node_module "https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix"
click node_readme "https://github.com/vitalbio/dash-haskell-flake/blob/main/README.md"
click node_nix_inputs "https://github.com/vitalbio/dash-haskell-flake/blob/main/flake.nix"
click node_dash_config "https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix"
click node_haddock "https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix"
click node_dashing "https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix"
click node_css_index "https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix"
click node_docset "https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix"
click node_default_output "https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix"

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_consumer,node_flake,node_module,node_readme,node_nix_inputs,node_dash_config toneBlue
class node_haskell_project,node_package,node_haddock,node_dashing,node_css_index toneAmber
class node_docset,node_default_output,node_publication toneMint
```

## Components

### Flake integration

- **Downstream flake**: consumer configuration · Defines haskellProjects and dashHaskell per system.
- [Flake entry](https://github.com/vitalbio/dash-haskell-flake/blob/main/flake.nix): flake export · `flake.nix`
- [Dash Haskell module](https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix): Nix module · `default.nix`
- [Configuration contract](https://github.com/vitalbio/dash-haskell-flake/blob/main/README.md): documentation · Documents dashHaskell attributes and output access. · `README.md`
- [Nix build inputs](https://github.com/vitalbio/dash-haskell-flake/blob/main/flake.nix): nixpkgs + flake-parts + haskell-flake · `flake.nix`
- [dashHaskell config](https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix): module options · Includes project selection, identity, version, URLs, and URL mapper. · `default.nix`

### Documentation pipeline

- **Selected Haskell project**: haskell-flake project
- **Configured package**: Haskell package
- [Haddock HTML](https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix): Nix derivation · Generated package documentation exposed as haddock. · `default.nix`
- [Dashing](https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix): docset builder · `default.nix`
- [Haddock selector index](https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix): CSS indexing rules · Indexes package/module headers, types, constructors, and functions. · `default.nix`

### Published outputs

- [Dash docset](https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix): Nix derivation · Dash-compatible documentation bundle and search index. · `default.nix`
- [outputs.default](https://github.com/vitalbio/dash-haskell-flake/blob/main/default.nix): module output · Contains haddock and docset derivations. · `default.nix`
- **Cache or Hydra hosting**: artifact publication · mkDocsetUrl maps store paths to downloadable docset URLs.

## Connections

- Downstream flake → Flake entry: imports flakeModule
- Flake entry → Dash Haskell module: exports
- Flake entry → Nix build inputs: pins
- Configuration contract → dashHaskell config: documents
- Downstream flake → dashHaskell config: configures
- Dash Haskell module → dashHaskell config: defines
- dashHaskell config → Selected Haskell project: selects
- Selected Haskell project → Configured package: provides
- Configured package → Haddock HTML: generates
- Haddock HTML → Dashing: HTML input
- Haddock selector index → Dashing: index selectors
- dashHaskell config → Dashing: metadata and URLs
- Dashing → Dash docset: assembles
- Haddock HTML → outputs.default: exports as haddock
- Dash docset → outputs.default: exports as docset
- dashHaskell config → Cache or Hydra hosting: mkDocsetUrl
- Dash docset → Cache or Hydra hosting: published artifact
