nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# To build this derivation, run `nix-build -A treefmt.optionsDoc`
2{
3 lib,
4 treefmt,
5 nixosOptionsDoc,
6}:
7
8let
9 configuration = treefmt.evalConfig [ ];
10
11 root = toString configuration._module.specialArgs.modulesPath;
12 revision = lib.trivial.revisionWithDefault "master";
13 removeRoot = file: lib.removePrefix "/" (lib.removePrefix root file);
14
15 transformDeclaration =
16 file:
17 let
18 fileStr = toString file;
19 subpath = "pkgs/by-name/tr/treefmt/modules/" + removeRoot fileStr;
20 in
21 assert lib.hasPrefix root fileStr;
22 {
23 url = "https://github.com/NixOS/nixpkgs/blob/${revision}/${subpath}";
24 name = subpath;
25 };
26in
27nixosOptionsDoc {
28 documentType = "none";
29 options = removeAttrs configuration.options [ "_module" ];
30 transformOptions = opt: opt // { declarations = map transformDeclaration opt.declarations; };
31}