Reusable Nix tooling for writing books with mdBook.
Get started quickly by using the default template:
nix flake new --template github:dwayne/nix-mdBook#default my-book
cd my-book
Initialize a Git repository:
git init
git add .
git commit -m "Initial commit"
Enter the development environment and serve your book:
nix develop
# Write your book
#
# Type 'init' or 'i' to get started
# Type 'build' or 'b' to build your book
# Type 'serve' or 's' to serve your book
# Type 'deploy' or 'd' to deploy your book
# Type 'clean' to remove build artifacts
#
# (my-book-env)
serve
Finally, start to write your book and watch your changes live in the browser.
Deploy your book using GitHub pages as follows:
It currently assumes the remote is called origin and the default branch is called master.
deploy.The first time it runs it builds your book, copies the generated files to a new orphan branch called gh-pages and pushes it to GitHub.
On subsequent runs it only commits the changes you made to the gh-pages branch and pushes those up to GitHub.
gh-pages branch.Read Configuring a publishing source for your GitHub Pages site.
highlight.jsproject = mdBook.lib.mkProject pkgs {
# ...
shell = {
autogenerateHighlightJs = false;
};
}
Maybe you want to write about context-free grammars:
project = mdBook.lib.mkProject pkgs {
# ...
shell = {
languages = [ "abnf" "bnf" "ebnf" ];
};
}
Nix
100.0%
Reusable Nix tooling for writing books with mdBook.
Get started quickly by using the default template:
nix flake new --template github:dwayne/nix-mdBook#default my-book
cd my-book
Initialize a Git repository:
git init
git add .
git commit -m "Initial commit"
Enter the development environment and serve your book:
nix develop
# Write your book
#
# Type 'init' or 'i' to get started
# Type 'build' or 'b' to build your book
# Type 'serve' or 's' to serve your book
# Type 'deploy' or 'd' to deploy your book
# Type 'clean' to remove build artifacts
#
# (my-book-env)
serve
Finally, start to write your book and watch your changes live in the browser.
Deploy your book using GitHub pages as follows:
It currently assumes the remote is called origin and the default branch is called master.
deploy.The first time it runs it builds your book, copies the generated files to a new orphan branch called gh-pages and pushes it to GitHub.
On subsequent runs it only commits the changes you made to the gh-pages branch and pushes those up to GitHub.
gh-pages branch.Read Configuring a publishing source for your GitHub Pages site.
highlight.jsproject = mdBook.lib.mkProject pkgs {
# ...
shell = {
autogenerateHighlightJs = false;
};
}
Maybe you want to write about context-free grammars:
project = mdBook.lib.mkProject pkgs {
# ...
shell = {
languages = [ "abnf" "bnf" "ebnf" ];
};
}
Nix
100.0%