configuration.nix/docs/default.nix

21 lines
640 B
Nix
Raw Normal View History

{ pkgs, lib, markdown }:
let
eval = lib.evalModules { modules = [ ../nixos/options.nix ]; };
nixos-markdown = (pkgs.nixosOptionsDoc { inherit (eval) options; }).optionsCommonMark;
in
2024-01-15 14:35:33 +01:00
{
markdown = nixos-markdown;
2024-01-15 14:35:33 +01:00
docs = pkgs.stdenvNoCC.mkDerivation {
name = "nixos-configuration-book";
src = ./.;
2024-01-15 14:35:33 +01:00
patchPhase = ''
# copy generated options removing the declared by statement
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-15 14:35:33 +01:00
buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out";
};
}