mlvzk / manix

A fast CLI documentation searcher for Nix.
Mozilla Public License 2.0
361 stars 19 forks source link

Add generated options documentation as another doc source #2

Closed elkowar closed 4 years ago

elkowar commented 4 years ago

The data that the generated JSON documentation from options can provide should be used as a documentation source. This would imply:

elkowar commented 4 years ago
with import <nixpkgs> {}; 
let 
  eval = import (pkgs.path + "/nixos/lib/eval-config.nix") { modules = []; }; 
  opts = (nixosOptionsDoc { options = eval.options; }).optionsJSON; 
in 
  runCommandLocal "options.json" { inherit opts; } "cp $opts/share/doc/nixos/options.json $out"

this generates the NixOS module documentation JSON, and home-manager json doc can be generated with nix-build -E '(import <home-manager> {}).docs.json'

elkowar commented 4 years ago

Also: we should look at parsing the XML the nix documentation is generated from, to get documentation for the stdenv and lib functions. The additional information and cleanness available there would also allow me to provide much better autocompletion (as looking at the documentation gives me a full namespace that i can mach against, whereas the comments don't allow for that)

elkowar commented 4 years ago

Both of this was implemented!