117: add disko-doc r=Mic92 a=Mic92



Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
This commit is contained in:
bors[bot] 2023-01-19 08:06:38 +00:00 committed by GitHub
commit f0a96e4de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

39
doc.nix Normal file
View File

@ -0,0 +1,39 @@
{ lib, nixosOptionsDoc, runCommand, fetchurl, pandoc }:
let
types = import ./types.nix { inherit lib; };
eval = lib.evalModules {
modules = [
{
options.disko = {
devices = lib.mkOption {
type = types.devices;
default = {};
description = "The devices to set up";
};
};
}
];
};
options = nixosOptionsDoc {
options = eval.options;
};
md = (runCommand "disko-options.md" { } ''
cat >$out <<EOF
# Disko options
EOF
cat ${options.optionsCommonMark} >>$out
'').overrideAttrs (o: {
# Work around https://github.com/hercules-ci/hercules-ci-agent/issues/168
allowSubstitutes = true;
});
css = fetchurl {
url = "https://gist.githubusercontent.com/killercup/5917178/raw/40840de5352083adb2693dc742e9f75dbb18650f/pandoc.css";
sha256 = "sha256-SzSvxBIrylxBF6B/mOImLlZ+GvCfpWNLzGFViLyOeTk=";
};
in runCommand "disko.html" { nativeBuildInputs = [ pandoc ]; } ''
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
''

View File

@ -22,6 +22,7 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in { in {
disko = pkgs.callPackage ./package.nix {}; disko = pkgs.callPackage ./package.nix {};
disko-doc = pkgs.callPackage ./doc.nix { };
default = self.packages.${system}.disko; default = self.packages.${system}.disko;
}); });
# TODO: disable bios-related tests on aarch64... # TODO: disable bios-related tests on aarch64...