1
0
Fork 0

build docs with nmd

This commit is contained in:
ibizaman 2023-11-30 09:06:42 -08:00
parent 86e86dc787
commit 05f16167f7
3 changed files with 89 additions and 1 deletions

13
docs/manual.xml Normal file
View file

@ -0,0 +1,13 @@
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="book-minimal-example">
<info>
<title>A simple example</title>
</info>
<chapter>
<title>A simple example</title>
<simpara>Hello, world!</simpara>
</chapter>
</book>

38
flake.lock generated
View file

@ -81,14 +81,52 @@
"type": "github"
}
},
"nmd": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"scss-reset": "scss-reset"
},
"locked": {
"lastModified": 1687627428,
"narHash": "sha256-7zGfXuNS5RHqhpEdz2fwrtqvF86JRo5U1hrxZSYgcm8=",
"ref": "refs/heads/master",
"rev": "824a380546b5d0d0eb701ff8cd5dbafb360750ff",
"revCount": 63,
"type": "git",
"url": "https://git.sr.ht/~rycee/nmd"
},
"original": {
"type": "git",
"url": "https://git.sr.ht/~rycee/nmd"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nix-flake-tests": "nix-flake-tests",
"nixpkgs": "nixpkgs",
"nmd": "nmd",
"sops-nix": "sops-nix"
}
},
"scss-reset": {
"flake": false,
"locked": {
"lastModified": 1631450058,
"narHash": "sha256-muDlZJPtXDIGevSEWkicPP0HQ6VtucbkMNygpGlBEUM=",
"owner": "andreymatin",
"repo": "scss-reset",
"rev": "0cf50e27a4e95e9bb5b1715eedf9c54dee1a5a91",
"type": "github"
},
"original": {
"owner": "andreymatin",
"repo": "scss-reset",
"type": "github"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2",

View file

@ -6,9 +6,11 @@
sops-nix.url = "github:Mic92/sops-nix";
nix-flake-tests.url = "github:antifuchs/nix-flake-tests";
flake-utils.url = "github:numtide/flake-utils";
nmd.url = "git+https://git.sr.ht/~rycee/nmd";
nmd.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, nix-flake-tests, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
outputs = { nixpkgs, nix-flake-tests, flake-utils, nmd, ... }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
@ -36,6 +38,41 @@
];
};
# Inspiration from https://github.com/nix-community/nix-on-droid/blob/039379abeee67144d4094d80bbdaf183fb2eabe5/docs/default.nix#L22
packages.manualHtml = let
nmdlib = import nmd { inherit pkgs; };
setupModule = {
_module.args.pkgs = pkgs.lib.mkForce (nmdlib.scrubDerivations "pkgs" pkgs);
_module.check = false;
};
modulesDocs = nmdlib.buildModulesDocs {
modules = [
setupModule
./modules/blocks/ssl.nix
];
moduleRootPaths = [ ../. ];
mkModuleUrl = path: "https://myproject.foo/${path}";
channelName = "selfhostblocks";
docBook = { id = "selfhostblocks-options"; optionIdPrefix = "shb-opt"; };
};
manual = nmdlib.buildDocBookDocs {
pathName = "SelfHostBlocks";
modulesDocs = [ modulesDocs ];
documentsDirectory = ./docs;
chunkToc = ''
<toc>
<d:tocentry xmlns:d="http://docbook.org/ns/docbook" linkend="book-manual">
<?dbhtml filename="index.html"?>
</d:tocentry>
</toc>
'';
};
in
manual.html;
checks =
let
importFiles = files: