updated documentation process
This commit is contained in:
@@ -36,12 +36,12 @@ jobs:
|
|||||||
|
|
||||||
- run: nix build .#docs
|
- run: nix build .#docs
|
||||||
|
|
||||||
- run: nix run .#pandoc
|
- run: mkdir -p out && cp ./result/* out
|
||||||
|
|
||||||
- name: Store pandoc
|
- name: Store docs
|
||||||
uses: ./.github/actions/upload-artifact
|
uses: ./.github/actions/upload-artifact
|
||||||
with:
|
with:
|
||||||
name: pandoc
|
name: docs
|
||||||
path: ./out
|
path: ./out
|
||||||
|
|
||||||
deploy-docs:
|
deploy-docs:
|
||||||
@@ -57,7 +57,7 @@ jobs:
|
|||||||
- name: Get nix build output
|
- name: Get nix build output
|
||||||
uses: ./.github/actions/download-artifact
|
uses: ./.github/actions/download-artifact
|
||||||
with:
|
with:
|
||||||
name: pandoc
|
name: docs
|
||||||
|
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v3
|
uses: actions/configure-pages@v3
|
||||||
|
|||||||
@@ -122,6 +122,10 @@ nixarr = {
|
|||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
Add a wiki with documentation and guides.
|
||||||
|
|
||||||
### DDNS
|
### DDNS
|
||||||
|
|
||||||
Add DDNS-support.
|
Add DDNS-support.
|
||||||
|
|||||||
+50
-8
@@ -3,7 +3,6 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
runCommand,
|
runCommand,
|
||||||
nixosOptionsDoc,
|
nixosOptionsDoc,
|
||||||
inputs,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
evalNixos = lib.evalModules {
|
evalNixos = lib.evalModules {
|
||||||
@@ -19,10 +18,53 @@
|
|||||||
optionsDocNixos = nixosOptionsDoc {
|
optionsDocNixos = nixosOptionsDoc {
|
||||||
inherit (evalNixos) options;
|
inherit (evalNixos) options;
|
||||||
};
|
};
|
||||||
in
|
in pkgs.stdenv.mkDerivation {
|
||||||
# create a derivation for capturing the markdown output
|
name = "nixdocs2html";
|
||||||
runCommand "options-doc.md" {} ''
|
src = ./.;
|
||||||
mkdir -p $out
|
buildInputs = with pkgs; [ pandoc ];
|
||||||
cat ${optionsDocNixos.optionsCommonMark} | tail -n +58 >> $out/nixos.md
|
phases = ["unpackPhase" "buildPhase"];
|
||||||
sed -i '/\*Declared by:\*/{N;d;}' $out/nixos.md
|
buildPhase = ''
|
||||||
''
|
tmpdir=$(mktemp -d)
|
||||||
|
mkdir -p $out
|
||||||
|
cp docs/styling/style.css $out
|
||||||
|
|
||||||
|
# Generate md docs
|
||||||
|
cat ${optionsDocNixos.optionsCommonMark} | tail -n +58 >> "$tmpdir"/nixos.md
|
||||||
|
|
||||||
|
# Remove "Declared by" lines
|
||||||
|
sed -i '/\*Declared by:\*/{N;d;}' "$tmpdir"/nixos.md
|
||||||
|
|
||||||
|
# Code blocks to nix code blocks
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
awk '
|
||||||
|
/^```$/ {
|
||||||
|
if (!block) {
|
||||||
|
print "```nix"; # Start of a code block
|
||||||
|
block = 1;
|
||||||
|
} else {
|
||||||
|
print "```"; # End of a code block
|
||||||
|
block = 0;
|
||||||
|
}
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
{ print } # Print all lines, including those inside code blocks
|
||||||
|
' block=0 "$tmpdir"/nixos.md > "$tmpdir"/1.md
|
||||||
|
# inline code "blocks" to nix code blocks
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
sed '/^`[^`]*`$/s/`\(.*\)`/```nix\n\1\n```/g' "$tmpdir"/1.md > "$tmpdir"/2.md
|
||||||
|
# Remove bottom util-nixarr options
|
||||||
|
sed '/util-nixarr/,$d' "$tmpdir"/2.md > "$tmpdir"/done.md
|
||||||
|
|
||||||
|
pandoc \
|
||||||
|
--standalone \
|
||||||
|
--highlight-style docs/styling/gruvbox.theme \
|
||||||
|
--metadata title="Nixarr - Option Documentation" \
|
||||||
|
--metadata date="$(date -u '+%Y-%m-%d - %H:%M:%S %Z')" \
|
||||||
|
--css=style.css \
|
||||||
|
-V lang=en \
|
||||||
|
-V --mathjax \
|
||||||
|
-f markdown+smart \
|
||||||
|
-o $out/index.html \
|
||||||
|
"$tmpdir"/done.md
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
{pkgs, ...}:
|
|
||||||
pkgs.writeShellApplication {
|
|
||||||
name = "my-script";
|
|
||||||
runtimeInputs = with pkgs; [ pandoc ];
|
|
||||||
text = ''
|
|
||||||
tmpdir=$(mktemp -d)
|
|
||||||
|
|
||||||
# Code blocks to nix code blocks
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
awk '
|
|
||||||
/^```$/ {
|
|
||||||
if (!block) {
|
|
||||||
print "```nix"; # Start of a code block
|
|
||||||
block = 1;
|
|
||||||
} else {
|
|
||||||
print "```"; # End of a code block
|
|
||||||
block = 0;
|
|
||||||
}
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
{ print } # Print all lines, including those inside code blocks
|
|
||||||
' block=0 result/nixos.md > "$tmpdir"/1.md
|
|
||||||
# inline code "blocks" to nix code blocks
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
sed '/^`[^`]*`$/s/`\(.*\)`/```nix\n\1\n```/g' "$tmpdir"/1.md > "$tmpdir"/2.md
|
|
||||||
# Remove bottom util-nixarr options
|
|
||||||
sed '/util-nixarr/,$d' "$tmpdir"/2.md > "$tmpdir"/done.md
|
|
||||||
|
|
||||||
mkdir -p out
|
|
||||||
cp docs/styling/style.css out
|
|
||||||
pandoc \
|
|
||||||
--standalone \
|
|
||||||
--highlight-style docs/styling/gruvbox.theme \
|
|
||||||
--metadata title="Nixarr - Option Documentation" \
|
|
||||||
--metadata date="$(date -u '+%Y-%m-%d - %H:%M:%S %Z')" \
|
|
||||||
--css=style.css \
|
|
||||||
-V lang=en \
|
|
||||||
-V --mathjax \
|
|
||||||
-f markdown+smart \
|
|
||||||
-o out/index.html \
|
|
||||||
"$tmpdir"/done.md
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user