mirror of
https://github.com/simplex-chat/haskell.nix.git
synced 2026-06-03 09:17:32 +00:00
09526c8555
* Spelling and typo fixes in doc and code comments * Trailing whitespace or whitespace only truncation * readTheDocs formatting corrections
62 lines
1.4 KiB
Nix
62 lines
1.4 KiB
Nix
{ pkgs ? import <nixpkgs> {}
|
|
, lib ? pkgs.lib
|
|
}:
|
|
let
|
|
# Provide a dummy pkg-def for the package set function
|
|
pkg-def = hackage: {
|
|
packages = {};
|
|
compiler = {
|
|
version = "";
|
|
nix-name = "";
|
|
packages = {};
|
|
};
|
|
};
|
|
|
|
# Apply the package set function to get NixOS options.
|
|
inherit (import ../package-set.nix { hackage = null; inherit pkgs pkg-def; }) options;
|
|
|
|
optionsNix = (pkgs.nixosOptionsDoc { inherit options; }).optionsNix;
|
|
|
|
optionsMarkdown = lib.concatStringsSep "\n" (lib.mapAttrsToList singleMarkdown optionsNix);
|
|
|
|
singleMarkdown = name: value: ''
|
|
## ${name}
|
|
|
|
${value.description}
|
|
|
|
**Type**: ${value.type}
|
|
|
|
${ if lib.hasAttr "default" value
|
|
then ''
|
|
**Default**: ${builtins.toJSON value.default}
|
|
''
|
|
else "**No Default**"
|
|
}
|
|
${ if value.readOnly
|
|
then "**Read Only**"
|
|
else ""
|
|
}
|
|
${ if lib.hasAttr "example" value
|
|
then ''
|
|
**Example**:
|
|
|
|
${builtins.toJSON value.example}
|
|
''
|
|
else "**No Example**"
|
|
}
|
|
|
|
'';
|
|
|
|
in builtins.toFile "options.md" ''
|
|
Haskell.nix modules options for packages and components.
|
|
|
|
!!! note "Generated"
|
|
This documentation is generated from Nix sources in the
|
|
[`modules`](https://github.com/input-output-hk/haskell.nix/tree/master/modules)
|
|
subdirectory using `scripts/update-docs.nix`
|
|
|
|
# Configuration Options
|
|
|
|
${optionsMarkdown}
|
|
''
|