diff --git a/.gitignore b/.gitignore index fa1a833..bb3a03f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ docs mkdocs-hooks/__pycache__ public result-doc +deploy.sh diff --git a/packages/lix-docs/default.nix b/packages/lix-docs/default.nix index 7ec2784..62b8495 100644 --- a/packages/lix-docs/default.nix +++ b/packages/lix-docs/default.nix @@ -1 +1,108 @@ -{ pkgs, ... }: pkgs.lix-docs +{ + lix-docs, + stdenv, + vim, + perl, + ... +}: +let + f = "find . -type f -exec"; + s = "${f} sed -i"; +in +stdenv.mkDerivation { + inherit (lix-docs) pname version; + + src = lix-docs.src; + + nativeBuildInputs = [ + vim + perl + ]; + + installPhase = '' + defaultFix() { + sed -i '1,2d' $0 + sed -i '1s/ - /\n\n/' $0 + sed -i '1s/^/# /' $0 + sed -i '3s/\w/\u&/' $0 + sed -i '3s/$/\./' $0 + } + export -f defaultFix + + mkdir $out + cp -r ${lix-docs.doc}/manualMD/* $out + chmod -R +w $out + pushd $out + mv introduction.md index.md + mv advanced-topics/advanced-topics.md advanced-topics/index.md + mv advanced-topics Advanced-Topics + mv architecture/architecture.md architecture/index.md + mv command-ref Command-Reference + pushd Command-Reference + mv command-ref.md index.md + mv files.md files/index.md + mv nix-env.md nix-env/index.md + mv nix-store.md nix-store/index.md + # Fixup all Nix3(aka new cli) commands + pushd new-cli + ${s} '6,7d' {} \; + ${s} '6s/ - /\n\n/' {} \; + ${s} '6s/^/# /' {} \; + ${s} '8s/\w/\u&/' {} \; + ${s} '8s/$/\./' {} \; + ${f} ex -c '1,5m9' -c w -c q {} \; + popd + mv new-cli New-CLI + # Fixup all non-nix3 commands + find . -type f -name "nix-*.md" -exec bash -c 'defaultFix "$0"' {} \; + # Fixup nix-store + pushd nix-store + find . -type f -name "*.md" -exec bash -c 'defaultFix "$0"' {} \; + sed -i 's!\./nix-store!\./!g' index.md + popd + + # Fixup Nix-env + pushd nix-env + find . -type f -name "*.md" -exec bash -c 'defaultFix "$0"' {} \; + sed -i 's!\./nix-env!\./!g' index.md + popd + popd + + # Contributing directory + pushd contributing + mv contributing.md index.md + ex -c '1,9m11' -c w -c q experimental-features.md + sed -i 's!^## \[\(.*\)\]!## \1 !g' experimental-features.md + popd + + # Final directories + mv installation/installation.md installation/index.md + mv package-management/package-management.md package-management/index.md + mv package-management Package-Management + mv protocols/protocols.md protocols/index.md + mv release-notes/release-notes.md release-notes/index.md + + # Admonitions + find . -type f -name "*.md" -exec perl -pi -e 's/