From d1a078560a23a144dce4a57d9a8fc69241592495 Mon Sep 17 00:00:00 2001 From: Pyrox Date: Mon, 1 Jul 2024 16:40:19 -0400 Subject: [PATCH] add nixpkgs options --- .editorconfig | 3 ++ flake.lock | 8 ++--- mkdocs.yml | 1 + packages/aux-wiki/default.nix | 4 +++ packages/md-manual/default.nix | 1 + packages/md-manual/index.md | 16 +++++++++ packages/nixpkgs-doc/default.nix | 13 -------- packages/nixpkgs-manual/default.nix | 43 +++++++++++++++++++++---- packages/nixpkgs-manual/options-doc.nix | 4 +++ packages/options-doc/default.nix | 32 ------------------ 10 files changed, 70 insertions(+), 55 deletions(-) create mode 100644 .editorconfig create mode 100644 packages/md-manual/index.md delete mode 100644 packages/nixpkgs-doc/default.nix create mode 100644 packages/nixpkgs-manual/options-doc.nix delete mode 100644 packages/options-doc/default.nix diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..560947d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.md] +indent_style = space +indent_size = 4 diff --git a/flake.lock b/flake.lock index 234bf99..ccaae2c 100644 --- a/flake.lock +++ b/flake.lock @@ -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" }, diff --git a/mkdocs.yml b/mkdocs.yml index fbd8f2c..44ba483 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -11,6 +11,7 @@ theme: favicon: assets/aux-logo.svg features: - search.highlight + - navigation.tabs - navigation.indexes - navigation.prune font: diff --git a/packages/aux-wiki/default.nix b/packages/aux-wiki/default.nix index 38e9faa..90b73ef 100644 --- a/packages/aux-wiki/default.nix +++ b/packages/aux-wiki/default.nix @@ -13,4 +13,8 @@ stdenvNoCC.mkDerivation { cp -r contributing $out/contributing cp -r docs $out/docs ''; + + fixupPhase = '' + mv $out/home.md $out/index.md + ''; } diff --git a/packages/md-manual/default.nix b/packages/md-manual/default.nix index 2326afc..48f95a5 100644 --- a/packages/md-manual/default.nix +++ b/packages/md-manual/default.nix @@ -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 diff --git a/packages/md-manual/index.md b/packages/md-manual/index.md new file mode 100644 index 0000000..c33278a --- /dev/null +++ b/packages/md-manual/index.md @@ -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! diff --git a/packages/nixpkgs-doc/default.nix b/packages/nixpkgs-doc/default.nix deleted file mode 100644 index 8949342..0000000 --- a/packages/nixpkgs-doc/default.nix +++ /dev/null @@ -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 - ''; -} diff --git a/packages/nixpkgs-manual/default.nix b/packages/nixpkgs-manual/default.nix index 5c013b7..1509772 100644 --- a/packages/nixpkgs-manual/default.nix +++ b/packages/nixpkgs-manual/default.nix @@ -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 diff --git a/packages/nixpkgs-manual/options-doc.nix b/packages/nixpkgs-manual/options-doc.nix new file mode 100644 index 0000000..3cbceaa --- /dev/null +++ b/packages/nixpkgs-manual/options-doc.nix @@ -0,0 +1,4 @@ +{ pkgs, inputs, ... }: +let + inherit (pkgs.lib) hasPrefix removePrefix; +in diff --git a/packages/options-doc/default.nix b/packages/options-doc/default.nix deleted file mode 100644 index 2c61e62..0000000 --- a/packages/options-doc/default.nix +++ /dev/null @@ -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; - }; -}