haskell.nix/scripts/options-doc.nix
Rodney Lorrimar e15f235319 More documentation (#179)
* docs: Fix notes about .nix-tools.cache

Relates to #57

* docs: Add note about Cabal 2.4 requirement

Fixes #164

* docs: Autogenerate module option reference

* docs: Update library reference

* Buildkite: enable docs build on branches
2019-06-15 07:11:52 +02:00

30 lines
841 B
Nix

{ pkgs ? import <nixpkgs> {}
, lib ? pkgs.lib
}:
let
# Provide a dummy pkg-def for the package set function
pkg-def = hackage: {
packages = {};
compiler = {
version = "";
nix-name = "";
packages = {};
};
};
# Apply the package set function to get NixOS options.
inherit (import ../package-set.nix { hackage = null; inherit pkgs pkg-def; }) options;
# Use code from the NixOS manual to generate Docbook XML options list.
manual = import (pkgs.path + /nixos/doc/manual) {
inherit pkgs options;
config.meta.doc = [];
version = "testing";
revision = "testing";
};
in
# Convert docbook options list to markdown
pkgs.runCommand "options.md" {} ''
${pkgs.buildPackages.pandoc}/bin/pandoc -s -f docbook -t markdown_strict ${manual.generatedSources}/options-db.xml -o $out
''