From e665e52fe21e8f6a10fcff6e01b5272a42d6bc72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Mon, 15 Jan 2024 14:35:33 +0100 Subject: [PATCH] feat(docs): Also output raw markdown --- docs/default.nix | 21 ++++++++++++--------- flake.nix | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 78b6bd8..7b3d51e 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -1,16 +1,19 @@ { pkgs, lib, ... }: let eval = lib.evalModules { modules = [ ../nixos/options.nix ]; }; - doc = (pkgs.nixosOptionsDoc { inherit (eval) options; }).optionsCommonMark; + markdown = (pkgs.nixosOptionsDoc { inherit (eval) options; }).optionsCommonMark; in -pkgs.stdenvNoCC.mkDerivation { - name = "nixos-configuration-book"; - src = ./.; +{ + inherit markdown; + docs = pkgs.stdenvNoCC.mkDerivation { + name = "nixos-configuration-book"; + src = ./.; - patchPhase = '' - # copy generated options removing the declared by statement - sed '/^\*Declared by:\*$/,/^$/d' <${doc} >> src/options.md - ''; + patchPhase = '' + # copy generated options removing the declared by statement + sed '/^\*Declared by:\*$/,/^$/d' <${markdown} >> src/options.md + ''; - buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out"; + buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out"; + }; } diff --git a/flake.nix b/flake.nix index b61d8e6..62a19e2 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,7 @@ supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs { inherit system; }; }); # Module documentation - doc = forEachSupportedSystem ({ pkgs }: { doc = import ./docs { inherit pkgs lib; }; }); + doc = forEachSupportedSystem ({ pkgs }: import ./docs { inherit pkgs lib; }); in { # Schemas tell Nix about the structure of your flake's outputs