2024-01-21 20:56:00 +01:00
|
|
|
{ pkgs, lib }:
|
2024-01-14 18:58:08 +01:00
|
|
|
let
|
2024-01-21 20:56:00 +01:00
|
|
|
nixos-eval = lib.evalModules { modules = [ ../nixos/options.nix ]; };
|
|
|
|
home-eval = lib.evalModules { modules = [ ../home/options.nix ]; };
|
2024-01-15 14:44:45 +01:00
|
|
|
nixos-markdown = (pkgs.nixosOptionsDoc {
|
2024-01-21 20:56:00 +01:00
|
|
|
inherit (nixos-eval) options;
|
|
|
|
transformOptions = option: option // { visible = option.visible && builtins.elemAt option.loc 0 == "jconfig"; };
|
|
|
|
}).optionsCommonMark;
|
|
|
|
home-markdown = (pkgs.nixosOptionsDoc {
|
|
|
|
inherit (home-eval) options;
|
2024-01-15 14:44:45 +01:00
|
|
|
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-21 20:56:00 +01:00
|
|
|
inherit nixos-markdown home-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-21 20:56:00 +01:00
|
|
|
sed '/^\*Declared by:\*$/,/^$/d' <${home-markdown} >> src/home-options.md
|
2024-01-15 14:43:46 +01:00
|
|
|
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
|
|
|
}
|