docs: add mkdocs-awesome-pages-plugin

This commit is contained in:
phaer 2024-06-13 13:05:36 +02:00
parent 6ff41abd61
commit 5c6e0e5e9a
5 changed files with 95 additions and 14 deletions

View File

@ -5,6 +5,7 @@ site_dir: !ENV out
plugins: plugins:
- search - search
- awesome-pages
hooks: hooks:
- hooks/render_options.py - hooks/render_options.py
@ -12,20 +13,6 @@ hooks:
extra_css: extra_css:
- style.css - style.css
nav:
- "Home": index.md
- "Getting Started": gettingstarted.md
- Concepts:
- "Modules": modules.md
- "Overriding Dependencies": overrides.md
- Examples:
- "👉 example repository": https://github.com/nix-community/dream2nix/tree/main/examples/repo-with-packages
- "👉 example repository using flakes": https://github.com/nix-community/dream2nix/tree/main/examples/repo-with-packages-flake)
- "👉 example packages": https://github.com/nix-community/dream2nix/tree/main/examples/packages)
- Reference:
- "pip": reference/pip/index.md
markdown_extensions: markdown_extensions:
- tables - tables
- admonition - admonition

14
docs/src/.pages Normal file
View File

@ -0,0 +1,14 @@
nav:
- "Home": index.md
- "Getting Started": gettingstarted.md
- Concepts:
- "Modules": modules.md
- "Overriding Dependencies": overrides.md
- Reference: reference
- Examples:
- "👉 example repository": https://github.com/nix-community/dream2nix/tree/main/examples/repo-with-packages
- "👉 example repository using flakes": https://github.com/nix-community/dream2nix/tree/main/examples/repo-with-packages-flake)
- "👉 example packages": https://github.com/nix-community/dream2nix/tree/main/examples/packages)
- Notes:
- "v1 API design docs": v1-api
- development-roundups

3
docs/src/v1-api/.pages Normal file
View File

@ -0,0 +1,3 @@
nav:
- summary.md
- ...

View File

@ -84,6 +84,11 @@
mkdir -p "$target_dir" mkdir -p "$target_dir"
ln -s ${sourcePath}/README.md "$target_dir/index.md" ln -s ${sourcePath}/README.md "$target_dir/index.md"
ln -s ${options.docs.${name}.optionsJSON}/share/doc/nixos/options.json "$target_dir" ln -s ${options.docs.${name}.optionsJSON}/share/doc/nixos/options.json "$target_dir"
cat > "$target_dir/.pages" <<EOF
collapse_single_pages: true
nav:
- ...
EOF
''; '';
in in
pkgs.runCommand "reference" { pkgs.runCommand "reference" {
@ -96,6 +101,7 @@
nativeBuildInputs = [ nativeBuildInputs = [
pkgs.python3.pkgs.mkdocs pkgs.python3.pkgs.mkdocs
pkgs.python3.pkgs.mkdocs-material pkgs.python3.pkgs.mkdocs-material
self.packages.${system}.mkdocs-awesome-pages-plugin
referenceDocs referenceDocs
]; ];
} '' } ''
@ -104,6 +110,21 @@
mkdocs build mkdocs build
''; '';
in { in {
packages.mkdocs-awesome-pages-plugin = pkgs.callPackage ./mkdocs-awesome-pages-plugin.nix {
inherit
(pkgs.python3.pkgs)
buildPythonPackage
mkdocs
wcmatch
natsort
beautifulsoup4
mock-open
importlib-metadata
poetry-core
pytestCheckHook
pythonOlder
;
};
packages.reference = referenceDocs; packages.reference = referenceDocs;
packages.website = website; packages.website = website;
devShells.website = let devShells.website = let

View File

@ -0,0 +1,56 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
poetry-core,
mkdocs,
wcmatch,
natsort,
pytestCheckHook,
beautifulsoup4,
mock-open,
importlib-metadata,
pythonOlder,
}:
buildPythonPackage rec {
pname = "mkdocs-awesome-pages-plugin";
version = "2.9.2";
pyproject = true;
disabled = pythonOlder "3.9";
src = fetchFromGitHub {
owner = "lukasgeiter";
repo = "mkdocs-awesome-pages-plugin";
rev = "refs/tags/v${version}";
hash = "sha256-pYyZ84eNrslxgLSBr3teQqmV7hA+LHwJ+Z99QgPdh6U=";
};
propagatedBuildInputs = [
mkdocs
wcmatch
natsort
];
nativeBuildInputs = [poetry-core];
nativeCheckInputs = [
pytestCheckHook
beautifulsoup4
mock-open
importlib-metadata
];
disabledTestPaths = [
# requires "generatedfiles" mkdocs plugin
"mkdocs_awesome_pages_plugin/tests/e2e/test_gen_files.py"
];
meta = with lib; {
description = "An MkDocs plugin that simplifies configuring page titles and their order";
homepage = "https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin";
changelog = "https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/blob/v${version}/CHANGELOG";
license = licenses.mit;
maintainers = with maintainers; [phaer];
};
}