configuration.nix/docs/default.nix

20 lines
533 B
Nix
Raw Normal View History

{ pkgs, lib, ... }:
let
eval = lib.evalModules { modules = [ ../nixos/options.nix ]; };
2024-01-15 14:35:33 +01:00
markdown = (pkgs.nixosOptionsDoc { inherit (eval) options; }).optionsCommonMark;
in
2024-01-15 14:35:33 +01:00
{
inherit markdown;
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/options.md
'';
2024-01-15 14:35:33 +01:00
buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out";
};
}