From 01135c8d1408807dbbf69f9125d0f0b773b0755e Mon Sep 17 00:00:00 2001 From: atagen Date: Sun, 2 Feb 2025 18:41:24 +1100 Subject: [PATCH] move docs --- README.md | 2 +- docs.nix | 34 --------------------------------- docs.md => docs/docs.md | 0 docs/docs.nix | 42 +++++++++++++++++++++++++++++++++++++++++ docs/gendocs.sh | 2 ++ 5 files changed, 45 insertions(+), 35 deletions(-) delete mode 100644 docs.nix rename docs.md => docs/docs.md (100%) create mode 100644 docs/docs.nix create mode 100755 docs/gendocs.sh diff --git a/README.md b/README.md index f2fe961..7f2ee18 100644 --- a/README.md +++ b/README.md @@ -152,5 +152,5 @@ in case you need manual control, an ides shell provides commands: - `restart`: do both of the above in succession ### documentation -see [module docs](docs.md) +see [module docs](docs/docs.md) diff --git a/docs.nix b/docs.nix deleted file mode 100644 index 8e28d92..0000000 --- a/docs.nix +++ /dev/null @@ -1,34 +0,0 @@ -with import {}; - _: let - eval = lib.evalModules { - specialArgs = {inherit pkgs;}; - modules = [./ides.nix ./modules]; - }; - optionsDoc = nixosOptionsDoc { - inherit (eval) options; - - transformOptions = opt: - opt - // { - # Clean up declaration sites to not refer to the NixOS source tree. - declarations = let - devDir = toString /home/bolt/code/ides; - inherit (lib) hasPrefix removePrefix; - in - map - (decl: - if hasPrefix (toString devDir) (toString decl) - then let - subpath = removePrefix "/" (removePrefix (toString devDir) (toString decl)); - in { - url = "https://git.atagen.co/atagen/ides/${subpath}"; - name = subpath; - } - else decl) - opt.declarations; - }; - }; - in - runCommand "docs.md" {} '' - cat ${optionsDoc.optionsCommonMark} > $out - '' diff --git a/docs.md b/docs/docs.md similarity index 100% rename from docs.md rename to docs/docs.md diff --git a/docs/docs.nix b/docs/docs.nix new file mode 100644 index 0000000..0c6585e --- /dev/null +++ b/docs/docs.nix @@ -0,0 +1,42 @@ +with import { }; +{ ... }: +let + eval = lib.evalModules { + specialArgs = { inherit pkgs; }; + modules = [ + ../ides.nix + ../modules + ]; + }; + optionsDoc = nixosOptionsDoc { + inherit (eval) options; + + transformOptions = + opt: + opt + // { + # Clean up declaration sites to not refer to the NixOS source tree. + declarations = + let + devDir = toString /home/bolt/code/ides; + inherit (lib) hasPrefix removePrefix; + in + map ( + decl: + if hasPrefix (toString devDir) (toString decl) then + let + subpath = removePrefix "/" (removePrefix (toString devDir) (toString decl)); + in + { + url = "https://git.atagen.co/atagen/ides/${subpath}"; + name = subpath; + } + else + decl + ) opt.declarations; + }; + }; +in +runCommand "docs.md" { } '' + cat ${optionsDoc.optionsCommonMark} > $out +'' diff --git a/docs/gendocs.sh b/docs/gendocs.sh new file mode 100755 index 0000000..5c022a5 --- /dev/null +++ b/docs/gendocs.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +cp $(nix-build docs.nix --no-out-link) docs.md