2024-01-15 14:43:46 +01:00
|
|
|
{ pkgs, lib, markdown }:
|
2024-01-14 18:58:08 +01:00
|
|
|
let
|
2024-01-15 12:42:01 +01:00
|
|
|
eval = lib.evalModules { modules = [ ../nixos/options.nix ]; };
|
2024-01-15 14:44:45 +01:00
|
|
|
nixos-markdown = (pkgs.nixosOptionsDoc {
|
|
|
|
inherit (eval) options;
|
|
|
|
transformOptions = option: option // { visible = option.visible && builtins.elemAt option.loc 0 == "jconfig"; };
|
2024-01-15 14:46:04 +01:00
|
|
|
}).optionsCommonMark;
|
2024-01-14 18:58:08 +01:00
|
|
|
in
|
2024-01-15 14:35:33 +01:00
|
|
|
{
|
2024-01-15 14:43:46 +01:00
|
|
|
markdown = nixos-markdown;
|
2024-01-15 14:35:33 +01:00
|
|
|
docs = pkgs.stdenvNoCC.mkDerivation {
|
|
|
|
name = "nixos-configuration-book";
|
|
|
|
src = ./.;
|
2024-01-14 18:58:08 +01:00
|
|
|
|
2024-01-15 14:35:33 +01:00
|
|
|
patchPhase = ''
|
|
|
|
# copy generated options removing the declared by statement
|
2024-01-15 14:43:46 +01:00
|
|
|
sed '/^\*Declared by:\*$/,/^$/d' <${markdown} >> src/home-options.md
|
|
|
|
sed '/^\*Declared by:\*$/,/^$/d' <${nixos-markdown} >> src/nixos-options.md
|
2024-01-15 14:35:33 +01:00
|
|
|
'';
|
2024-01-14 18:58:08 +01:00
|
|
|
|
2024-01-15 14:35:33 +01:00
|
|
|
buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out";
|
|
|
|
};
|
2024-01-14 18:58:08 +01:00
|
|
|
}
|