From d45c30f160a93cf3dc67d6a3d9ddcc1870eae5de Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 22 Mar 2024 13:32:01 +0000 Subject: [PATCH] docs: fix moduleDoc being interpreted by bash Including the `moduleDoc` text directly in the `copy_docs` script meant special chars were interpreted by bash. Write the text to the nix store so we can `cat` a file instead. --- docs/mdbook/default.nix | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/mdbook/default.nix b/docs/mdbook/default.nix index aab9bd51..7a3a035b 100644 --- a/docs/mdbook/default.nix +++ b/docs/mdbook/default.nix @@ -202,14 +202,15 @@ with lib; let + ( if opts.index.moduleDoc == null then "cp ${mkMDDoc opts.index.options} ${path}" - else '' - { - cat < ${path} - '' + else + # Including moduleDoc's text directly will result in bash interpreting special chars, + # write it to the nix store and `cat` the file instead. + '' + { + cat ${pkgs.writeText "module-doc" opts.index.moduleDoc} + cat ${mkMDDoc opts.index.options} + } > ${path} + '' ) ) modules;