liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

doc.nix (1278B)


      1 {
      2   stdenv,
      3   lib,
      4   liminix,
      5   gnumake,
      6   pandoc,
      7   luaPackages,
      8   asciidoctor,
      9   borderVmConf,
     10 }:
     11 let
     12   fennel = luaPackages.fennel;
     13   json =
     14     (import liminix {
     15       inherit borderVmConf;
     16       device = import (liminix + "/devices/qemu");
     17       liminix-config =
     18         { ... }:
     19         {
     20           imports = [ ./modules/all-modules.nix ];
     21         };
     22     }).outputs.optionsJson;
     23 in
     24 stdenv.mkDerivation {
     25   name = "liminix-doc";
     26   nativeBuildInputs = [
     27     gnumake
     28     fennel
     29     pandoc
     30     asciidoctor
     31     luaPackages.lyaml
     32   ];
     33 
     34   src = lib.sources.sourceFilesBySuffices (lib.cleanSource ./.) [
     35     ".adoc"
     36     ".nix"
     37     ".rst"
     38     "Makefile"
     39     ".svg"
     40     ".fnl"
     41     ".py"
     42     ".css"
     43     ".html"
     44     ".md"
     45     ".html.in"
     46   ];
     47 
     48   buildPhase = ''
     49     cat ${json} | fennel --correlate doc/parse-options.fnl > doc/module-options-generated.inc.rst
     50     cat ${json} | fennel --correlate doc/parse-options-outputs.fnl     > doc/outputs-generated.inc.rst
     51     cp ${(import ./doc/hardware.nix)} doc/hardware.adoc
     52     make -C doc html
     53   '';
     54   installPhase = ''
     55     mkdir -p $out/nix-support
     56     cd doc
     57     make install prefix=$out
     58     ln -s ${json} $out/options.json
     59     echo "file source-dist \"$out/share/doc/liminix\"" \
     60         > $out/nix-support/hydra-build-products
     61   '';
     62 }