From 36ef99fca6895955070df40f824333d8186c3184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 15 Jan 2023 21:34:52 +0100 Subject: [PATCH] add disko-doc --- doc.nix | 39 +++++++++++++++++++++++++++++++++++++++ flake.nix | 1 + 2 files changed, 40 insertions(+) create mode 100644 doc.nix diff --git a/doc.nix b/doc.nix new file mode 100644 index 0000000..ab2bedf --- /dev/null +++ b/doc.nix @@ -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 <>$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 +'' diff --git a/flake.nix b/flake.nix index 2137583..51eef2c 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,7 @@ pkgs = nixpkgs.legacyPackages.${system}; in { disko = pkgs.callPackage ./package.nix {}; + disko-doc = pkgs.callPackage ./doc.nix { }; default = self.packages.${system}.disko; }); # TODO: disable bios-related tests on aarch64...