files.mdbook
by default it creates gh-pages/mdbook.toml and gh-pages/src/SUMMARY.md
It also create publish-as-gh-pages helper
Full configuration example
#examples/book.nix
{lib, ...}:
let
project = "devshell-files";
author = "cruel-intentions";
org-url = "https://github.com/${author}";
edit-path = "${org-url}/${project}/edit/master/examples/{path}";
in
{
files.mdbook.authors = ["Cruel Intentions <${org-url}>"];
files.mdbook.enable = true;
files.mdbook.gh-author = author;
files.mdbook.gh-project = project;
files.mdbook.language = "en";
files.mdbook.multilingual = false;
files.mdbook.summary = builtins.readFile ./summary.md;
files.mdbook.title = "Nix DevShell Files Maker";
files.mdbook.output.html.edit-url-template = edit-path;
files.mdbook.output.html.fold.enable = true;
files.mdbook.output.html.git-repository-url = "${org-url}/${project}/tree/master";
files.mdbook.output.html.no-section-label = true;
files.mdbook.output.html.site-url = "/${project}/";
files.gitignore.pattern.gh-pages = true;
files.text."/gh-pages/src/introduction.md" = builtins.readFile ./readme/about.md;
files.text."/gh-pages/src/installation.md" = builtins.readFile ./readme/installation.md;
files.text."/gh-pages/src/examples.md" = builtins.import ./readme/examples.nix;
files.text."/gh-pages/src/modules.md" = "## Writing new modules";
files.text."/gh-pages/src/nix-lang.md" = builtins.readFile ./readme/modules/nix-lang.md;
files.text."/gh-pages/src/json-nix.md" = builtins.import ./readme/modules/json-vs-nix.nix lib;
files.text."/gh-pages/src/module-spec.md" = builtins.readFile ./readme/modules/modules.md;
files.text."/gh-pages/src/share.md" = builtins.readFile ./readme/modules/share.md;
files.text."/gh-pages/src/document.md" = builtins.import ./readme/modules/document.nix;
files.text."/gh-pages/src/builtins.md" = builtins.readFile ./readme/modules/builtins.md;
files.text."/gh-pages/src/todo.md" = builtins.readFile ./readme/todo.md;
files.text."/gh-pages/src/issues.md" = builtins.readFile ./readme/issues.md;
files.text."/gh-pages/src/seeAlso.md" = builtins.readFile ./readme/seeAlso.md;
files.alias.publish-as-gh-pages-from-local = ''
# same as publish-as-gh-pages but works local
cd $PRJ_ROOT
ORIGIN=`git remote get-url origin`
cd gh-pages
mdbook build
cd book
git init .
git add .
git checkout -b gh-pages
git commit -m "docs(gh-pages): update gh-pages" .
git remote add origin $ORIGIN
git push -u origin gh-pages --force
'';
}
type
submodule
default
{
files.mdbook = { };
}
files.mdbook.enable
type
boolean
example
{
files.mdbook.enable = true;
}
default
{
files.mdbook.enable = false;
}
files.mdbook.authors
type
null or (non-empty (list of string))
example
{
files.mdbook.authors = [
"Cruel Intentions"
];
}
default
{
files.mdbook.authors = null;
}
files.mdbook.build
type
JSON value
example
{
files.mdbook.build = {
build-dir = "book";
};
}
default
{
files.mdbook.build = { };
}
files.mdbook.description
type
null or string
example
{
files.mdbook.description = "Modules Docummentation";
}
default
{
files.mdbook.description = null;
}
files.mdbook.gh-author
type
null or string
example
{
files.mdbook.gh-author = "cruel-intentions";
}
default
{
files.mdbook.gh-author = null;
}
files.mdbook.gh-project
type
null or string
example
{
files.mdbook.gh-project = "devshell-files";
}
default
{
files.mdbook.gh-project = null;
}
files.mdbook.language
type
null or non-empty string
example
{
files.mdbook.language = "en";
}
default
{
files.mdbook.language = null;
}
files.mdbook.multilingual
type
boolean
example
{
files.mdbook.multilingual = true;
}
default
{
files.mdbook.multilingual = false;
}
files.mdbook.output
type
JSON value
example
{
files.mdbook.output = {
html = {
fold = {
enable = true;
};
};
};
}
default
{
files.mdbook.output = { };
}
files.mdbook.preprocessor
type
JSON value
example
{
files.mdbook.preprocessor = {
mathjax = {
renderers = [
"html"
];
};
};
}
default
{
files.mdbook.preprocessor = { };
}
files.mdbook.root-dir
type
non-empty string
example
{
files.mdbook.root-dir = "/gh-pages";
}
default
{
files.mdbook.root-dir = "/gh-pages";
}
files.mdbook.rust
type
JSON value
example
{
files.mdbook.rust = {
edition = "2018";
};
}
default
{
files.mdbook.rust = { };
}
files.mdbook.summary
type
strings concatenated with "\n"
example
{
files.mdbook.summary = ''
# SUMMARY
- [Intro](./intro.md)
'';
}
default
{
files.mdbook.summary = ''
# SUMMARY
'';
}
files.mdbook.title
type
null or string
example
{
files.mdbook.title = "Devshell Files Modules";
}
default
{
files.mdbook.title = null;
}
files.mdbook.use-default-preprocessor
type
boolean
example
{
files.mdbook.use-default-preprocessor = false;
}
default
{
files.mdbook.use-default-preprocessor = true;
}