How vitalbio/dash-haskell-flake works
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 dashHaskell config · flake.nix Flake entry · README.md Configuration contract
Components 14
Flake integration
- Downstream flake · Defines haskellProjects and dashHaskell per system.
- Flake entry
flake.nix - Dash Haskell module
default.nix - Configuration contract · Documents dashHaskell attributes and output access.
README.md - Nix build inputs
flake.nix - dashHaskell config · Includes project selection, identity, version, URLs, and URL mapper.
default.nix
Documentation pipeline
- Selected Haskell project
- Configured package
- Haddock HTML · Generated package documentation exposed as haddock.
default.nix - Dashing
default.nix - Haddock selector index · Indexes package/module headers, types, constructors, and functions.
default.nix
Published outputs
- Dash docset · Dash-compatible documentation bundle and search index.
default.nix - outputs.default · Contains haddock and docset derivations.
default.nix - Cache or Hydra hosting · mkDocsetUrl maps store paths to downloadable docset URLs.
Connections 17
- 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