Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions docs/render.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
Text to display in TOC for this options group
'';
};

modules = mkOption {
type = listOf deferredModule;
description = ''
List of modules to scan/render options
'';
};

namespaces = mkOption {
type = listOf str;
description = ''
Expand All @@ -40,6 +42,7 @@
Path to be replaced
'';
};

githubUrl = mkOption {
type = str;
description = ''
Expand All @@ -51,26 +54,38 @@
in {
options.renderDocs = {
enable = mkEnableOption "Document rendering";

name = mkOption {
type = str;
description = ''
Title of the documentation
'';
};

directory = mkOption {
type = path;
default = "${self}/docs";
description = ''
Directorying containing the documentation
'';
};

packageName = mkOption {
type = str;
default = "docs";
description = ''
Name of package containing the documentation
'';
};

mkdocsYamlFile = mkOption {
type = path;
default = "${self}/docs/mkdocs.yml";
default = "${cfg.directory}/mkdocs.yml";
description = ''
Path to the mkdocs.yml file
'';
};

devshells = mkOption {
type = listOf str;
default = ["default"];
Expand Down Expand Up @@ -230,12 +245,16 @@ in {
mkMerge ([
{
packages.${cfg.packageName} = stdenv.mkDerivation {
src = ../.; # FIXME: use config.flake-root.package here
# src = builtins.trace config.flake-root.package config.flake-root.package;
src = cfg.directory;
inherit (cfg) name;

nativeBuildInputs = [my-mkdocs];

unpackPhase = ''
cp -r $src docs
chmod -R +w docs
'';

buildPhase = ''
ln -s ${options-doc} ${docsPath}
# mkdocs expect mkdocs one level upper than `docs/`, but we want to keep it in `docs/`
Expand Down