simple nix module documentation wrapper
Find a file
2025-07-30 16:42:12 +10:00
flake.nix refactor: expose nixosOptionsDoc args, add multiple output formats 2025-07-30 16:10:15 +10:00
LICENSE init 2025-05-25 19:02:20 +10:00
RANT.md rewrite readme for new outputs 2025-07-30 16:42:12 +10:00
README.md rewrite readme for new outputs 2025-07-30 16:42:12 +10:00

UNF

unf is the simplest possible way to generate documentation for a nix module.

given a few straightforward parameters, its lib provides documentation outputs for:

  • a full documentation website (html, via ndg)
  • commonmark (md)
  • json
  • yaml
  • toml
  • rudimentary xml
  • raw nix attrs

here's how it works:

# in your flake
{
	inputs = {
		nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
		unf.url = "git+https://git.atagen.co/atagen/unf";	
	};

	outputs = { self, nixpkgs, unf }: {
	  packages.${system}.docs = unf.lib.html {
			# a reference to your flake's self, for path replacement
			inherit self;
			# an instance of nixpkgs, required for evaluating the raw options
			pkgs = nixpkgs.legacyPackages.${system};
			# the name of your project, for page title etc
			projectName = "unf";    
			# the intended base path for files referred to by your docs, ie. your public repo
			newPath = "https://git.atagen.co/atagen/unf";  
			# any specialArgs you want in the module system while evaluating your options
			specialArgs = { goodDx = true; };  
			# the modules you wish to document
			modules = [ ./nix/interface.nix ]; 
			# any options the user wishes to pass to nixosOptionsDoc
			userOpts = { warningsAreErrors = false; };
	  };
	};
}

# in your shell
$ nix build .#docs

and that's it.

enjoy !

if you are looking for the old readme, it is here