initial commit

This commit is contained in:
Pyrox 2024-06-30 01:43:43 -04:00
commit a9eee47991
Signed by: pyrox
GPG key ID: 8CDF3F7CAA53A0F5
16 changed files with 696 additions and 0 deletions

4
.envrc Normal file
View file

@ -0,0 +1,4 @@
if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w="
fi
use flake

7
.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
result
.direnv
book
docs/nixpkgs-doc
docs
.cache/plugin/social
mkdocs-hooks/__pycache__

34
assets/aux-logo.svg Normal file
View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 270.93333 270.93333" version="1.1" id="svg1" inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)" sodipodi:docname="auxolotl-logo.svg" inkscape:export-filename="auxolotl-cuddle3.svg" inkscape:export-xdpi="96" inkscape:export-ydpi="96">
<defs id="defs1">
<linearGradient id="linearGradient5" inkscape:collect="always">
<stop style="stop-color:#f0a3d5;stop-opacity:1;" offset="0.49842149" id="stop4"/>
<stop style="stop-color:#89c5f1;stop-opacity:1;" offset="1" id="stop5"/>
</linearGradient>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient5" id="linearGradient2" x1="153.08398" y1="116.19141" x2="182.14844" y2="107.01758" gradientUnits="userSpaceOnUse" gradientTransform="translate(12.016015,-10.358081)"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient5" id="linearGradient4" x1="147.5293" y1="95.201172" x2="172.55078" y2="69.738281" gradientUnits="userSpaceOnUse" gradientTransform="translate(13.337361,-6.3011758)"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient5" id="linearGradient7" x1="131.19531" y1="81" x2="144.85742" y2="48.019531" gradientUnits="userSpaceOnUse" gradientTransform="translate(16.971352,-4.8000023)"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient5" id="linearGradient17" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1,0,0,1,216.58398,-10.358081)" x1="153.08398" y1="116.19141" x2="182.14844" y2="107.01758"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient5" id="linearGradient18" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1,0,0,1,215.26263,-6.3011763)" x1="147.5293" y1="95.201172" x2="172.55078" y2="69.738281"/>
<linearGradient inkscape:collect="always" xlink:href="#linearGradient5" id="linearGradient19" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1,0,0,1,211.62864,-4.8000028)" x1="131.19531" y1="81" x2="144.85742" y2="48.019531"/>
</defs>
<g inkscape:groupmode="layer" id="layer2" inkscape:label="bg"/>
<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1">
<path id="rect1" d="m 105.83333,76.199985 h 16.93333 a 33.866665,35.560001 0 0 1 33.86667,35.560005 v 6.77335 a 16.126972,16.933322 0 0 1 -16.12697,16.93332 H 88.093639 A 16.126972,16.933322 0 0 1 71.966667,118.53334 v -6.77335 A 33.866665,35.560001 0 0 1 105.83333,76.199985 Z" style="font-variation-settings:'wght' 800;fill:#ead2d2;fill-opacity:1;fill-rule:nonzero;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"/>
<ellipse style="font-variation-settings:'wght' 800;fill:#16181d;fill-opacity:1;stroke:none;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none" id="path2" cx="97.366684" cy="101.60001" rx="8.4666681" ry="8.4666777"/>
<ellipse style="font-variation-settings:'wght' 800;fill:#16181d;fill-opacity:1;stroke:none;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none" id="path2-5" cx="131.23337" cy="101.60001" rx="8.4666653" ry="8.4666777"/>
<path style="font-variation-settings:'wght' 800;fill:#ead2d2;fill-opacity:1;fill-rule:nonzero;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="m 97.366669,152.39999 v 1e-5 a 50.800004,50.800004 0 0 0 50.800001,50.8 h 33.86665 a 50.800008,50.800008 0 0 0 50.8,-50.8 l 1e-5,-67.733336 a 7.0140145,7.0140145 0 0 0 -11.97367,-4.959657 l -3.9325,3.932498 A 61.321,61.321 0 0 0 198.96666,127 v 25.4 a 16.933344,16.933344 0 0 1 -16.93334,16.93334 H 148.16667 A 16.933344,16.933344 0 0 1 131.23333,152.4 v -1e-5 a 8.4666539,8.4666539 0 0 0 -8.46665,-8.46665 h -16.93336 a 8.4666539,8.4666539 0 0 0 -8.466651,8.46665 z" id="path6" sodipodi:nodetypes="ccccccccc"/>
<circle style="font-variation-settings:'wght' 800;fill:#ead2d2;fill-opacity:1;fill-rule:nonzero;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" id="path13" cx="76.20002" cy="165.09998" r="12.699999" inkscape:label="path13"/>
<circle style="font-variation-settings:'wght' 800;fill:#ead2d2;fill-opacity:1;fill-rule:nonzero;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" id="path13-6" cx="148.16664" cy="152.39999" r="8.4666615"/>
<circle style="font-variation-settings:'wght' 800;fill:#ead2d2;fill-opacity:1;fill-rule:nonzero;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" id="path13-0" cx="182.03331" cy="152.39999" r="8.4666681"/>
<circle style="font-variation-settings:'wght' 800;fill:#ead2d2;fill-opacity:1;fill-rule:nonzero;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" id="path13-0-3" cx="220.13332" cy="215.89999" r="12.699999"/>
<path style="color:#000000;fill:url(#linearGradient2);fill-opacity:1;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="m 190.74843,94.485665 a 5.2916498,5.2916498 0 0 0 -3.95508,0.87891 c -4.80672,3.36976 -10.53208,5.177735 -16.40234,5.177735 a 5.2916498,5.2916498 0 0 0 -5.29102,5.29102 5.2916498,5.2916498 0 0 0 5.29102,5.29101 c 8.04303,0 15.89266,-2.47672 22.47852,-7.09375 a 5.2916498,5.2916498 0 0 0 1.29492,-7.371095 5.2916498,5.2916498 0 0 0 -3.41602,-2.17383 z" id="path15"/>
<path style="color:#000000;fill:url(#linearGradient4);fill-opacity:1;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="m 185.88814,63.437106 a 5.2916665,5.2916665 0 0 0 -6.88867,2.925781 c -2.83974,7.028598 -8.35211,12.635686 -15.33008,15.597657 a 5.2916665,5.2916665 0 0 0 -2.80273,6.939453 5.2916665,5.2916665 0 0 0 6.9375,2.802738 c 9.55796,-4.057118 17.11812,-11.749644 21.00781,-21.376957 a 5.2916665,5.2916665 0 0 0 -2.92383,-6.888672 z" id="path15-7"/>
<path style="color:#000000;fill:url(#linearGradient7);fill-opacity:1;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="m 161.82877,43.219528 a 5.2916665,5.2916665 0 0 0 -5.29297,5.291016 c 0,7.580586 -3.00885,14.844794 -8.36914,20.205078 a 5.2916665,5.2916665 0 0 0 0,7.484375 5.2916665,5.2916665 0 0 0 7.48438,0 c 7.34216,-7.342167 11.46875,-17.306061 11.46875,-27.689453 a 5.2916665,5.2916665 0 0 0 -5.29102,-5.291016 z" id="path15-7-6"/>
<path style="color:#000000;fill:url(#linearGradient17);fill-opacity:1;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="m 37.85156,94.485665 a 5.2916498,5.2916498 0 0 1 3.95508,0.87891 c 4.80672,3.36976 10.53208,5.177725 16.40234,5.177725 a 5.2916498,5.2916498 0 0 1 5.29102,5.29102 5.2916498,5.2916498 0 0 1 -5.29102,5.29101 c -8.04303,0 -15.89266,-2.47672 -22.47852,-7.09375 a 5.2916498,5.2916498 0 0 1 -1.29492,-7.371085 5.2916498,5.2916498 0 0 1 3.41602,-2.17383 z" id="path14"/>
<path style="color:#000000;fill:url(#linearGradient18);fill-opacity:1;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="m 42.71185,63.437106 a 5.2916665,5.2916665 0 0 1 6.88867,2.925781 c 2.83974,7.028598 8.35211,12.635686 15.33008,15.597657 a 5.2916665,5.2916665 0 0 1 2.80273,6.939453 5.2916665,5.2916665 0 0 1 -6.9375,2.802738 C 51.23787,87.645617 43.67771,79.953091 39.78802,70.325778 a 5.2916665,5.2916665 0 0 1 2.92383,-6.888672 z" id="path16"/>
<path style="color:#000000;fill:url(#linearGradient19);fill-opacity:1;stroke:#16181d;stroke-width:16.4042;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" d="m 66.77122,43.219528 a 5.2916665,5.2916665 0 0 1 5.29297,5.291016 c 0,7.580586 3.00885,14.844794 8.36914,20.205078 a 5.2916665,5.2916665 0 0 1 0,7.484375 5.2916665,5.2916665 0 0 1 -7.48438,0 C 65.60679,68.85783 61.4802,58.893936 61.4802,48.510544 a 5.2916665,5.2916665 0 0 1 5.29102,-5.291016 z" id="path17"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.5 KiB

118
flake.lock Normal file
View file

@ -0,0 +1,118 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils-plus": {
"inputs": {
"flake-utils": "flake-utils"
},
"locked": {
"lastModified": 1715533576,
"narHash": "sha256-fT4ppWeCJ0uR300EH3i7kmgRZnAVxrH+XtK09jQWihk=",
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f",
"type": "github"
},
"original": {
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"rev": "3542fe9126dc492e53ddd252bb0260fe035f2c0f",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1719468428,
"narHash": "sha256-vN5xJAZ4UGREEglh3lfbbkIj+MPEYMuqewMn4atZFaQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1e3deb3d8a86a870d925760db1a5adecc64d329d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"snowfall-lib": "snowfall-lib"
}
},
"snowfall-lib": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils-plus": "flake-utils-plus",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1719005984,
"narHash": "sha256-mpFl3Jv4fKnn+5znYXG6SsBjfXHJdRG5FEqNSPx0GLA=",
"owner": "snowfallorg",
"repo": "lib",
"rev": "c6238c83de101729c5de3a29586ba166a9a65622",
"type": "github"
},
"original": {
"owner": "snowfallorg",
"repo": "lib",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

50
flake.nix Normal file
View file

@ -0,0 +1,50 @@
{
description = "Aux Manual Generator";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
inputs.snowfall-lib = {
url = "github:snowfallorg/lib";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{ self, ... }:
inputs.snowfall-lib.mkFlake {
inherit inputs;
src = ./.;
snowfall = {
namespace = "amg";
meta = {
name = "aux-manual-gen";
title = "Aux Manual Generator";
};
};
outputs-builder =
channels:
let
pkgs = channels.nixpkgs;
spkgs = self.packages.${pkgs.system};
libsets = (import ./nixpkgs-doc/libsets.nix);
in
{
packages = {
lib-docs = pkgs.callPackage ./nixpkgs-doc/doc-support/lib-function-docs.nix {
inherit
libsets
pkgs
spkgs
inputs
;
};
doc-locations-json = pkgs.callPackage ./nixpkgs-doc/doc-support/lib-function-locations.nix {
inherit libsets pkgs;
};
md-manual = pkgs.callPackage ./nixpkgs-doc/md-manual.nix { inherit spkgs inputs; };
python-interp-table = pkgs.callPackage ./nixpkgs-doc/doc-support/python-interpreter-table.nix { };
options-doc = pkgs.callPackage ./nixpkgs-doc/options-doc.nix { inherit pkgs inputs; };
nixpkgs-doc = pkgs.callPackage ./nixpkgs-doc/nixpkgs-doc.nix { inherit inputs; };
manual-assets = pkgs.callPackage ./nixpkgs-doc/manual-assets.nix { };
};
};
};
}

5
mkdocs-hooks/fonts.py Normal file
View file

@ -0,0 +1,5 @@
def on_post_page(output, page, config):
return output.replace(
"https://fonts.googleapis.com/css",
"https://fonts.bunny.net/css"
)

36
mkdocs.yml Normal file
View file

@ -0,0 +1,36 @@
site_name: Aux Docs
site_url: https://auxdocs.pyrox.dev/
theme:
name: material
features:
- search.highlight
font:
text: IBM Plex Sans
code: IBM Plex Mono
language: en
logo: assets/aux-logo.svg
hooks:
- mkdocs-hooks/fonts.py
plugins:
- search
- social
markdown_extensions:
- admonition
- attr_list
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.highlight
- pymdownx.superfences
extra:
social:
- icon: simple/forgejo
link: https://git.pyrox.dev/pyrox/aux-docs
name: Aux Docs Repo
- icon: simple/discourse
link: https://forum.aux.computer/
name: Aux Forum
- icon: simple/wikidotjs
link: https://wiki.auxolotl.org/
name: Aux Wiki

View file

@ -0,0 +1,51 @@
# Generates the documentation for library functions via nixdoc.
{
pkgs,
spkgs,
libsets,
inputs,
}:
let
inherit (pkgs) stdenv lib nixdoc;
in
stdenv.mkDerivation {
name = "nixpkgs-lib-docs";
src = "${inputs.nixpkgs.outPath}/lib";
buildInputs = [ nixdoc ];
installPhase = ''
function docgen {
name=$1
baseName=$2
description=$3
# TODO: wrap lib.$name in <literal>, make nixdoc not escape it
if [[ -e "../lib/$baseName.nix" ]]; then
nixdoc -c "$name" -d "lib.$name: $description" -l ${spkgs.doc-locations-json} -f "$baseName.nix" > "$out/$name.md"
else
nixdoc -c "$name" -d "lib.$name: $description" -l ${spkgs.doc-locations-json} -f "$baseName/default.nix" > "$out/$name.md"
fi
echo "$out/$name.md" >> "$out/index.md"
}
mkdir -p "$out"
cat > "$out/index.md" << 'EOF'
```{=include=} sections auto-id-prefix=auto-generated
EOF
${lib.concatMapStrings (
{
name,
baseName ? name,
description,
}:
''
docgen ${name} ${baseName} ${lib.escapeShellArg description}
''
) libsets}
echo '```' >> "$out/index.md"
'';
}

View file

@ -0,0 +1,85 @@
{
pkgs,
nixpkgs ? { },
libsets,
}:
let
revision = pkgs.lib.trivial.revisionWithDefault (nixpkgs.rev or "master");
libDefPos =
prefix: set:
builtins.concatMap (
name:
[
{
name = builtins.concatStringsSep "." (prefix ++ [ name ]);
location = builtins.unsafeGetAttrPos name set;
}
]
++ nixpkgsLib.optionals (builtins.length prefix == 0 && builtins.isAttrs set.${name}) (
libDefPos (prefix ++ [ name ]) set.${name}
)
) (builtins.attrNames set);
libset =
toplib:
builtins.map (subsetname: {
subsetname = subsetname;
functions = libDefPos [ ] toplib.${subsetname};
}) (builtins.map (x: x.name) libsets);
nixpkgsLib = pkgs.lib;
flattenedLibSubset =
{ subsetname, functions }:
builtins.map (fn: {
name = "lib.${subsetname}.${fn.name}";
value = fn.location;
}) functions;
locatedlibsets = libs: builtins.map flattenedLibSubset (libset libs);
removeFilenamePrefix =
prefix: filename:
let
prefixLen = (builtins.stringLength prefix) + 1; # +1 to remove the leading /
filenameLen = builtins.stringLength filename;
substr = builtins.substring prefixLen filenameLen filename;
in
substr;
removeNixpkgs = removeFilenamePrefix (builtins.toString pkgs.path);
liblocations = builtins.filter (elem: elem.value != null) (
nixpkgsLib.lists.flatten (locatedlibsets nixpkgsLib)
);
fnLocationRelative =
{ name, value }:
{
inherit name;
value = value // {
file = removeNixpkgs value.file;
};
};
relativeLocs = (builtins.map fnLocationRelative liblocations);
sanitizeId = builtins.replaceStrings [ "'" ] [ "-prime" ];
urlPrefix = "https://github.com/NixOS/nixpkgs/blob/${revision}";
jsonLocs = builtins.listToAttrs (
builtins.map (
{ name, value }:
{
name = sanitizeId name;
value =
let
text = "${value.file}:${builtins.toString value.line}";
target = "${urlPrefix}/${value.file}#L${builtins.toString value.line}";
in
"[${text}](${target}) in `<nixpkgs>`";
}
) relativeLocs
);
in
pkgs.writeText "locations.json" (builtins.toJSON jsonLocs)

View file

@ -0,0 +1,63 @@
# For debugging, run in this directory:
# nix eval --impure --raw --expr 'import ./python-interpreter-table.nix {}'
{ pkgs ? (import ../.. { config = { }; overlays = []; }) }:
let
lib = pkgs.lib;
inherit (lib.attrsets) attrNames filterAttrs;
inherit (lib.lists) elem filter map naturalSort reverseList;
inherit (lib.strings) concatStringsSep;
isPythonInterpreter = name:
/* NB: Package names that don't follow the regular expression:
- `python-cosmopolitan` is not part of `pkgs.pythonInterpreters`.
- `_prebuilt` interpreters are used for bootstrapping internally.
- `python3Minimal` contains python packages, left behind conservatively.
- `rustpython` lacks `pythonVersion` and `implementation`.
*/
(lib.strings.match "(pypy|python)([[:digit:]]*)" name) != null;
interpreterName = pname:
let
cuteName = {
cpython = "CPython";
pypy = "PyPy";
};
interpreter = pkgs.${pname};
in
"${cuteName.${interpreter.implementation}} ${interpreter.pythonVersion}";
interpreters = reverseList (naturalSort (
filter isPythonInterpreter (attrNames pkgs.pythonInterpreters)
));
aliases = pname:
attrNames (
filterAttrs (name: value:
isPythonInterpreter name
&& name != pname
&& interpreterName name == interpreterName pname
) pkgs
);
result = map (pname: {
inherit pname;
aliases = aliases pname;
interpreter = interpreterName pname;
}) interpreters;
toMarkdown = data:
let
line = package: ''
| ${package.pname} | ${join ", " package.aliases or [ ]} | ${package.interpreter} |
'';
in
join "" (map line data);
join = lib.strings.concatStringsSep;
in
''
| Package | Aliases | Interpeter |
|---------|---------|------------|
${toMarkdown result}
''

79
nixpkgs-doc/libsets.nix Normal file
View file

@ -0,0 +1,79 @@
[
{
name = "asserts";
description = "assertion functions";
}
{
name = "attrsets";
description = "attribute set functions";
}
{
name = "strings";
description = "string manipulation functions";
}
{
name = "versions";
description = "version string functions";
}
{
name = "trivial";
description = "miscellaneous functions";
}
{
name = "fixedPoints";
baseName = "fixed-points";
description = "explicit recursion functions";
}
{
name = "lists";
description = "list manipulation functions";
}
{
name = "debug";
description = "debugging functions";
}
{
name = "options";
description = "NixOS / nixpkgs option handling";
}
{
name = "path";
description = "path functions";
}
{
name = "filesystem";
description = "filesystem functions";
}
{
name = "fileset";
description = "file set functions";
}
{
name = "sources";
description = "source filtering functions";
}
{
name = "cli";
description = "command-line serialization functions";
}
{
name = "generators";
description = "functions that create file formats from nix data structures";
}
{
name = "gvariant";
description = "GVariant formatted string serialization functions";
}
{
name = "customisation";
description = "Functions to customise (derivation-related) functions, derivatons, or attribute sets";
}
{
name = "meta";
description = "functions for derivation metadata";
}
{
name = "derivations";
description = "miscellaneous derivation-specific functions";
}
]

View file

@ -0,0 +1,14 @@
{ stdenvNoCC }:
stdenvNoCC.mkDerivation {
pname = "aux-manual-assets";
version = "0.0.0";
src = ../assets;
phases = "installPhase";
installPhase = ''
mkdir $out
cp $src/* $out
'';
}

81
nixpkgs-doc/md-manual.nix Normal file
View file

@ -0,0 +1,81 @@
{
lib,
nixos-render-docs,
python3,
perl,
stdenvNoCC,
spkgs,
inputs,
}:
stdenvNoCC.mkDerivation {
name = "nixpkgs-manual-md";
nativeBuildInputs = [
nixos-render-docs
python3
perl
];
src = inputs.nixpkgs;
patchPhase = ''
cd doc
find . -type f ! -name '*.md' ! -name '*.md.in' -exec rm {} \+
'';
postPatch = ''
ln -s ${spkgs.options-doc.optionsJSON}/share/doc/nixos/options.json ./config-options.json
'';
pythonInterpreterTable = spkgs.python-interp-table;
passAsFile = [ "pythonInterpreterTable" ];
buildPhase = ''
substituteInPlace ./languages-frameworks/python.section.md --subst-var-by python-interpreter-table "$(<"$pythonInterpreterTablePath")"
cat \
./functions/library.md.in \
${spkgs.lib-docs}/index.md \
> ./functions/library.md
substitute ./manual.md.in ./manual.md \
--replace-fail '@MANUAL_VERSION@' '${lib.version}'
mkdir out
mkdir out/assets
cp ${spkgs.manual-assets}/* out/assets/
mv preface.chapter.md out/index.md
mv build-helpers out/build-helpers
mv build-helpers.md out/build-helpers/index.md
mv contributing out/contributing
mv contributing.md out/contributing/index.md
mv development out/development
mv development.md out/development/index.md
mv functions out/functions
mv functions.md out/functions/index.md
mv hooks out/hooks
mv languages-frameworks out/languages-frameworks
mkdir out/lib
cp ${spkgs.lib-docs}/*.md out/lib/
mv module-system out/module-system
mv packages out/packages
mv stdenv out/stdenv
mv stdenv.md out/stdenv/index.md
mv using out/using
mv using-nixpkgs.md out/using/index.md
pushd out
find . -type f -exec perl -pi -e 's/\s*:::{.note}\n/!!! note\n\ \ /' {} \;
find . -type f -exec perl -pi -e 's/\s*:::{.warning}\n/!!! warning\n\ \ /' {} \;
find . -type f -exec perl -pi -e 's/\s*:::{.tip}\n/!!! tip\n\ \ \ \ /' {} \;
find . -type f -exec perl -pi -e 's/\s*:::{.example}\n/!!! example\n\ \ \ \ /' {} \;
find . -type f -exec sed -i 's/\s*::://g' {} \;
popd
'';
installPhase = ''
mkdir $out
mv out/* $out
'';
}

View file

@ -0,0 +1,13 @@
{ stdenv, inputs }:
stdenv.mkDerivation {
pname = "nixpkgs-doc-src";
version = "unstable";
src = inputs.nixpkgs.outPath;
phases = "installPhase";
installPhase = ''
cp -r doc/ $out
'';
}

View file

@ -0,0 +1,32 @@
{ pkgs, inputs }:
let
inherit (pkgs.lib) hasPrefix removePrefix;
in
pkgs.nixosOptionsDoc {
inherit
(pkgs.lib.evalModules {
modules = [ "${inputs.nixpkgs.outPath}/pkgs/top-level/config.nix" ];
class = "nixpkgsConfig";
})
options
;
documentType = "none";
transformOptions =
opt:
opt
// {
declarations = map (
decl:
if hasPrefix (toString ../..) (toString decl) then
let
subpath = removePrefix "/" (removePrefix (toString ../.) (toString decl));
in
{
url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}";
name = subpath;
}
else
decl
) opt.declarations;
};
}

View file

@ -0,0 +1,24 @@
{ pkgs, ... }:
let
customPython = pkgs.python312.withPackages (ps: [
ps.mkdocs-material
ps.mkdocs
ps.pillow
ps.cairosvg
]);
in
pkgs.mkShell {
buildInputs = [
customPython
pkgs.deadnix
pkgs.nixfmt-rfc-style
pkgs.statix
pkgs.nixd
pkgs.nil
pkgs.nixdoc
pkgs.nixos-render-docs
pkgs.mdbook
pkgs.nix-tree
pkgs.mdbook-admonish
];
}