blob: 95b9dea58069a4a6c2dde3883a0bef0fe8569fc9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
{ pkgs ? import <nixpkgs> { config = {}; overlays = []; }
}:
let
evaluated = pkgs.lib.evalModules {
modules = [
../openwrt
];
specialArgs = {
inherit pkgs;
};
};
optionsDoc = pkgs.nixosOptionsDoc {
inherit (evaluated) options;
transformOptions = opt:
let
cwd = toString ../.;
shorten = decl:
let
removed = pkgs.lib.removePrefix cwd decl;
in
if removed != decl
then {
url =
"https://git.eno.space/dewclaw.git/tree${removed}"
+ (if pkgs.lib.hasSuffix ".nix" removed
then ""
else "/default.nix");
name = "<dewclaw${removed}>";
}
else removed;
in
opt // { declarations = map shorten opt.declarations; };
};
in
pkgs.runCommand "dewclaw-book" {
src = ./src;
buildInputs = [ pkgs.mdbook ];
} ''
cp -r --no-preserve=all $src ./src
ln -s ${optionsDoc.optionsCommonMark} ./src/options.md
ln -s ${../README.md} ./src/README.md
mdbook build
mv book $out
''
|