add nixpkgs options

This commit is contained in:
Pyrox 2024-07-01 16:40:19 -04:00
parent d0b76f2c6d
commit d1a078560a
Signed by untrusted user: pyrox
GPG key ID: 8CDF3F7CAA53A0F5
10 changed files with 70 additions and 55 deletions

3
.editorconfig Normal file
View file

@ -0,0 +1,3 @@
[*.md]
indent_style = space
indent_size = 4

View file

@ -3,11 +3,11 @@
"aux-wiki": {
"flake": false,
"locked": {
"lastModified": 1719683482,
"narHash": "sha256-WF9uI8hbuvy+zCoCJa967mVnqyCbZBf3FSth6vwDR/I=",
"lastModified": 1719862127,
"narHash": "sha256-612nyIoAmN88HjYUnQhR0AXiE2kxGwc8KtceQPqT2/U=",
"ref": "refs/heads/main",
"rev": "3af79f1e4db60efba1f1b772628796b097c144ed",
"revCount": 187,
"rev": "6dd47c5dac718707eb9c95f3efe2013c90e7946d",
"revCount": 200,
"type": "git",
"url": "https://git.auxolotl.org/auxolotl/wiki"
},

View file

@ -11,6 +11,7 @@ theme:
favicon: assets/aux-logo.svg
features:
- search.highlight
- navigation.tabs
- navigation.indexes
- navigation.prune
font:

View file

@ -13,4 +13,8 @@ stdenvNoCC.mkDerivation {
cp -r contributing $out/contributing
cp -r docs $out/docs
'';
fixupPhase = ''
mv $out/home.md $out/index.md
'';
}

View file

@ -7,6 +7,7 @@ stdenvNoCC.mkDerivation {
installPhase = ''
mkdir $out
cp index.md $out/index.md
cp -r ${pkgs.amg.manual-assets} $out/assets
cp -r ${pkgs.amg.nixpkgs-manual} $out/Nixpkgs/
cp -r ${pkgs.amg.aux-wiki} $out/Aux

View file

@ -0,0 +1,16 @@
# Aux Documentation Hub
Welcome to the Aux Documentation Hub. This aims to be a centralized place for documentation all across the Nix\*, Aux, and Lix ecosystems.
This is a fully searchable site, using the search bar in the top right.
We host the following documentation:
- [Nixpkgs Docs](Nixpkgs)
Docs for the Nixpkgs package set, including what to package, how to package, and code standards for Nixpkgs.
Sourced from [Nixpkgs itself](https://github.com/NixOS/nixpkgs/tree/master/doc)
- [Aux Wiki](Aux)
The [Aux Wiki](https://wiki.auxolotl.org), rendered and searchable here, statically. No JS required!

View file

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

View file

@ -8,6 +8,36 @@
inputs,
...
}:
let
optionsDoc = 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 lib.hasPrefix (toString ../..) (toString decl) then
let
subpath = lib.removePrefix "/" (lib.removePrefix (toString ../.) (toString decl));
in
{
url = "https://github.com/NixOS/nixpkgs/blob/master/${subpath}";
name = subpath;
}
else
decl
) opt.declarations;
};
};
in
stdenvNoCC.mkDerivation {
name = "nixpkgs-manual-md";
@ -19,13 +49,8 @@ stdenvNoCC.mkDerivation {
src = inputs.nixpkgs;
patchPhase = ''
cd doc
find . -type f ! -name '*.md' ! -name '*.md.in' -exec rm {} \+
'';
postPatch = ''
ln -s ${pkgs.amg.options-doc.optionsJSON}/share/doc/nixos/options.json ./config-options.json
cd doc
'';
pythonInterpreterTable = pkgs.callPackage ./python-interp-table.nix { };
@ -33,6 +58,11 @@ stdenvNoCC.mkDerivation {
passAsFile = [ "pythonInterpreterTable" ];
buildPhase = ''
nixos-render-docs -j $NIX_BUILD_CORES options commonmark \
--manpage-urls ./manpage-urls.json \
--revision ${inputs.nixpkgs.rev} \
${optionsDoc.optionsJSON}/share/doc/nixos/options.json ./options.md
substituteInPlace ./languages-frameworks/python.section.md --subst-var-by python-interpreter-table "$(<"$pythonInterpreterTablePath")"
mv ./functions/library.md.in ./functions/library.md
@ -41,6 +71,7 @@ stdenvNoCC.mkDerivation {
mkdir out
mv preface.chapter.md out/index.md
mv options.md out/
mv build-helpers out/build-helpers
mv build-helpers.md out/build-helpers/index.md
mv development out/development

View file

@ -0,0 +1,4 @@
{ pkgs, inputs, ... }:
let
inherit (pkgs.lib) hasPrefix removePrefix;
in

View file

@ -1,32 +0,0 @@
{ 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;
};
}