docs: clean after serve

Don't pollute the tmpdir with old versions of the serve
This commit is contained in:
zimbatm 2023-02-09 12:17:47 +01:00
parent 4471f09b22
commit 90beb2b579
No known key found for this signature in database
GPG Key ID: 71BAF6D40C1D63D7

View File

@ -3,8 +3,11 @@
packages.docs = pkgs.runCommand "nixos-anywhere-docs"
{
passthru.serve = pkgs.writeShellScriptBin "serve" ''
set -euo pipefail
cd docs
${lib.getExe pkgs.mdbook} serve --dest-dir $(${pkgs.coreutils}/bin/mktemp -d)
workdir=$(${pkgs.coreutils}/bin/mktemp -d)
trap 'rm -rf "$workdir"' EXIT
${lib.getExe pkgs.mdbook} serve --dest-dir "$workdir"
'';
}
''