disko/doc.nix

44 lines
1.2 KiB
Nix
Raw Normal View History

2023-01-15 20:34:52 +00:00
{ lib, nixosOptionsDoc, runCommand, fetchurl, pandoc }:
let
2023-05-16 11:40:03 +00:00
diskoLib = import ./lib {
inherit lib;
rootMountPoint = "/mnt";
};
2023-01-15 20:34:52 +00:00
eval = lib.evalModules {
modules = [
2023-01-15 20:34:52 +00:00
{
options.disko = {
devices = lib.mkOption {
2023-07-13 13:08:20 +00:00
type = diskoLib.toplevel;
default = { };
2023-01-15 20:34:52 +00:00
description = "The devices to set up";
};
};
}
];
};
options = nixosOptionsDoc {
options = eval.options;
2023-01-15 20:34:52 +00:00
};
md = (runCommand "disko-options.md" { } ''
cat >$out <<EOF
# Disko options
EOF
cat ${options.optionsCommonMark} >>$out
2023-06-06 11:32:47 +00:00
'').overrideAttrs (_o: {
# Work around https://github.com/hercules-ci/hercules-ci-agent/issues/168
allowSubstitutes = true;
2023-01-15 20:34:52 +00:00
});
css = fetchurl {
url = "https://gist.githubusercontent.com/killercup/5917178/raw/40840de5352083adb2693dc742e9f75dbb18650f/pandoc.css";
sha256 = "sha256-SzSvxBIrylxBF6B/mOImLlZ+GvCfpWNLzGFViLyOeTk=";
};
in
runCommand "disko.html" { nativeBuildInputs = [ pandoc ]; } ''
2023-01-15 20:34:52 +00:00
mkdir $out
cp ${css} $out/pandoc.css
pandoc --css="pandoc.css" ${md} --to=html5 -s -f markdown+smart --metadata pagetitle="Disko options" -o $out/index.html
''