Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

# Generate the HTML manual pages
html = pkgs.callPackage ./manual.nix {
inherit release;
inherit inputs release;
inherit (nvimModuleDocs) optionsJSON;
};
in {
Expand Down
147 changes: 40 additions & 107 deletions docs/manual.nix
Original file line number Diff line number Diff line change
@@ -1,114 +1,47 @@
{
lib,
inputs,
path,
stdenvNoCC,
fetchzip,
runCommandLocal,
# build inputs
nixos-render-docs,
documentation-highlighter,
dart-sass,
path,
# nrd configuration
release,
optionsJSON,
release,
} @ args: let
manual-release = args.release or "unstable";

scss-reset = fetchzip {
url = "https://github.com/Frontend-Layers/scss-reset/archive/refs/tags/1.4.2.zip";
hash = "sha256-cif5Sx8Ca5vxdw/mNAgpulLH15TwmzyJFNM7JURpoaE=";
};

compileStylesheet = runCommandLocal "compile-nvf-stylesheet" {} ''
mkdir -p $out

tmpfile=$(mktemp -d)
trap "rm -r $tmpfile" EXIT

ln -s "${scss-reset}/build" "$tmpfile/scss-reset"

${dart-sass}/bin/sass --load-path "$tmpfile" \
${./static/style.scss} "$out/style.css"

echo "Generated styles"
'';
in
stdenvNoCC.mkDerivation {
name = "nvf-manual";
src = builtins.path {
name = "nvf-manual-${manual-release}";
path = lib.sourceFilesBySuffices ./manual [".md" ".md.in"];
};

strictDependencies = true;
nativeBuildInputs = [nixos-render-docs];

postPatch = ''
ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
'';

buildPhase = ''
dest="$out/share/doc/nvf"
mkdir -p "$(dirname "$dest")"
mkdir -p $dest/{highlightjs,script}

# Copy highlight scripts to /highlights in document root.
cp -vt $dest/highlightjs \
${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \
${documentation-highlighter}/loader.js

# Copy anchor scripts to the script directory in document root.
cp -vt "$dest"/script \
${./static/script}/anchor-min.js \
${./static/script}/anchor-use.js \
${./static/script}/search.js

substituteInPlace ./options.md \
--subst-var-by OPTIONS_JSON ./config-options.json

substituteInPlace ./manual.md \
--subst-var-by NVF_VERSION ${manual-release}

substituteInPlace ./hacking/additional-plugins.md \
--subst-var-by NVF_REPO "https://github.com/notashelf/nvf/blob/${manual-release}"

# Move compiled stylesheet
cp -vt $dest \
${compileStylesheet}/style.css

# Move release notes
cp -vr ${./release-notes} release-notes

# Generate final manual from a set of parameters. Explanation of the CLI flags are
# as follows:
#
# 1. --manpage-urls will allow you to use manual pages as they are defined in
# the nixpkgs documentation.
# 2. --revision is the project revision as it is defined in 'release.json' in the
# repository root
# 3. --script will inject a given Javascript file into the resulting pages inside
# the <script> tag.
# 4. --toc-depth will determine the depth of the initial Table of Contents while
# --section-toc-depth will determine the depth of per-section Table of Contents
# sections.
nixos-render-docs manual html \
--manpage-urls ${path + "/doc/manpage-urls.json"} \
--revision ${lib.trivial.revisionWithDefault manual-release} \
--stylesheet style.css \
--script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \
--script script/anchor-use.js \
--script script/anchor-min.js \
--script script/search.js \
--toc-depth 1 \
--section-toc-depth 1 \
manual.md \
"$dest/index.xhtml"

# Hydra support. Probably not necessary.
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
'';
}
runCommandLocal "nvf-docs-html" {
nativeBuildInputs = [
(inputs.ndg.packages.${stdenvNoCC.system}.ndg.overrideAttrs
{
# FIXME: the tests take too long to build
doCheck = false;
})
];
} ''
mkdir -p $out/share/doc

# Copy the markdown sources to be processed by ndg. This is not
# strictly necessary, but allows us to modify the Markdown sources
# as we see fit.
cp -rvf ${./manual} ./manual

# Replace variables following the @VARIABLE@ style in the manual
# pages. This can be built into ndg at a later date.
substituteInPlace ./manual/index.md \
--subst-var-by NVF_VERSION ${manual-release}

# Generate the final manual from a set of parameters. This uses
# feel-co/ndg to render the web manual.
ndg html \
--jobs $NIX_BUILD_CORES --title "NVF" \
--module-options ${optionsJSON}/share/doc/nixos/options.json \
--manpage-urls ${path}/doc/manpage-urls.json \
--options-depth 3 \
--generate-search \
--highlight-code \
--input-dir ./manual \
--output-dir "$out/share/doc"

# Hydra support. Probably not necessary.
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
''
5 changes: 3 additions & 2 deletions docs/manual/configuring.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Configuring nvf {#ch-configuring}

[helpful tips section]: #ch-helpful-tips
[helpful tips section]: ./tips.html#ch-helpful-tips
[options reference]: ./options.html

nvf allows for _very_ extensive configuration in Neovim through the Nix module
interface. The below chapters describe several of the options exposed in nvf for
your convenience. You might also be interested in the [helpful tips section] for
more advanced or unusual configuration options supported by nvf.

Note that this section does not cover module _options_. For an overview of all
module options provided by nvf, please visit the [appendix](/nvf/options.html)
module options provided by nvf, please visit the [options reference]

```{=include=} chapters
configuring/custom-package.md
Expand Down
22 changes: 0 additions & 22 deletions docs/manual/configuring/custom-package.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/manual/configuring/custom-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ as a module.
:::{.info}

To add a plugin to your runtime, you will need to add it to
[](#opt-vim.startPlugins) list in your configuration. This is akin to cloning a
{option}`vim.startPlugins` list in your configuration. This is akin to cloning a
plugin to `~/.config/nvim`, but they are only ever placed in the Nix store and
never exposed to the outside world for purity and full isolation.

Expand Down
14 changes: 7 additions & 7 deletions docs/manual/configuring/custom-plugins/legacy-method.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Legacy Method {#sec-legacy-method}

Prior to version **0.5**, the method of adding new plugins was adding the plugin
package to [](#opt-vim.startPlugins) and adding its configuration as a DAG under
one of `vim.configRC` or [](#opt-vim.luaConfigRC). While `configRC` has been
deprecated, users who have not yet updated to 0.5 or those who prefer a more
hands-on approach may choose to use the old method where the load order of the
plugins is explicitly determined by DAGs without internal abstractions.
package to {option}`vim.startPlugins` and adding its configuration as a DAG
under one of `vim.configRC` or {option}`vim.luaConfigRC`. While `configRC` has
been deprecated, users who have not yet updated to 0.5 or those who prefer a
more hands-on approach may choose to use the old method where the load order of
the plugins is explicitly determined by DAGs without internal abstractions.

## Adding New Plugins {#sec-adding-new-plugins}

To add a plugin not available in **nvf** as a module to your configuration using
the legacy method, you must add it to [](#opt-vim.startPlugins) in order to make
it available to Neovim at runtime.
the legacy method, you must add it to {option}`vim.startPlugins` in order to
make it available to Neovim at runtime.

```nix
{pkgs, ...}: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

As of version **0.5**, we have a more extensive API for configuring plugins that
should be preferred over the legacy method. This API is available as
[](#opt-vim.extraPlugins). Instead of using DAGs exposed by the library
{option}`vim.extraPlugins`. Instead of using DAGs exposed by the library
_directly_, you may use the extra plugin module as follows:

```nix
Expand Down
122 changes: 80 additions & 42 deletions docs/manual/configuring/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,87 @@ formatters, and `nvim-lint` linter integration. This gets you capabilities
ranging from autocompletion to formatting to diagnostics. The following
languages have sections under the `vim.languages` attribute.

- Rust: [vim.languages.rust.enable](#opt-vim.languages.rust.enable)
- Nix: [vim.languages.nix.enable](#opt-vim.languages.nix.enable)
- SQL: [vim.languages.sql.enable](#opt-vim.languages.sql.enable)
- C/C++: [vim.languages.clang.enable](#opt-vim.languages.clang.enable)
- Typescript/Javascript: [vim.languages.ts.enable](#opt-vim.languages.ts.enable)
- Python: [vim.languages.python.enable](#opt-vim.languages.python.enable):
- Zig: [vim.languages.zig.enable](#opt-vim.languages.zig.enable)
- Markdown: [vim.languages.markdown.enable](#opt-vim.languages.markdown.enable)
- HTML: [vim.languages.html.enable](#opt-vim.languages.html.enable)
- Dart: [vim.languages.dart.enable](#opt-vim.languages.dart.enable)
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
- F#: [vim.languages.fsharp.enable](#opt-vim.languages.fsharp.enable)
- Assembly: [vim.languages.assembly.enable](#opt-vim.languages.assembly.enable)
- Astro: [vim.languages.astro.enable](#opt-vim.languages.astro.enable)
- Bash: [vim.languages.bash.enable](#opt-vim.languages.bash.enable)
- Clang: [vim.languages.clang.enable](#opt-vim.languages.clang.enable)
- Clojure: [vim.languages.clojure.enable](#opt-vim.languages.clojure.enable)
- C#: [vim.languages.csharp.enable](#opt-vim.languages.csharp.enable)
- CSS: [vim.languages.css.enable](#opt-vim.languages.css.enable)
- CUE: [vim.languages.cue.enable](#opt-vim.languages.cue.enable)
- Elixir: [vim.languages.elixir.enable](#opt-vim.languages.elixir.enable)
- Gleam: [vim.languages.gleam.enable](#opt-vim.languages.gleam.enable)
- HCL: [vim.languages.hcl.enable](#opt-vim.languages.hcl.enable)
- Helm: [vim.languages.helm.enable](#opt-vim.languages.helm.enable)
- Julia: [vim.languages.julia.enable](#opt-vim.languages.julia.enable)
- Kotlin: [vim.languages.kotlin.enable](#opt-vim.languages.kotlin.enable)
- Nim: [vim.languages.nim.enable](#opt-vim.languages.nim.enable)
- Nu: [vim.languages.nu.enable](#opt-vim.languages.nu.enable)
- OCaml: [vim.languages.ocaml.enable](#opt-vim.languages.ocaml.enable)
- Odin: [vim.languages.odin.enable](#opt-vim.languages.odin.enable)
- R: [vim.languages.r.enable](#opt-vim.languages.r.enable)
- Ruby: [vim.languages.ruby.enable](#opt-vim.languages.ruby.enable)
- Scala: [vim.languages.scala.enable](#opt-vim.languages.scala.enable)
- Svelte: [vim.languages.svelte.enable](#opt-vim.languages.svelte.enable)
- Tailwind: [vim.languages.tailwind.enable](#opt-vim.languages.tailwind.enable)
- Rust:
[vim.languages.rust.enable](./options.html#option-vim-languages-rust-enable)
- Nix:
[vim.languages.nix.enable](./options.html#option-vim-languages-nix-enable)
- SQL:
[vim.languages.sql.enable](./options.html#option-vim-languages-sql-enable)
- C/C++:
[vim.languages.clang.enable](./options.html#option-vim-languages-clang-enable)
- Typescript/Javascript:
[vim.languages.ts.enable](./options.html#option-vim-languages-ts-enable)
- Python:
[vim.languages.python.enable](./options.html#option-vim-languages-python-enable):
- Zig:
[vim.languages.zig.enable](./options.html#option-vim-languages-zig-enable)
- Markdown:
[vim.languages.markdown.enable](./options.html#option-vim-languages-markdown-enable)
- HTML:
[vim.languages.html.enable](./options.html#option-vim-languages-html-enable)
- Dart:
[vim.languages.dart.enable](./options.html#option-vim-languages-dart-enable)
- Go: [vim.languages.go.enable](./options.html#option-vim-languages-go-enable)
- Lua:
[vim.languages.lua.enable](./options.html#option-vim-languages-lua-enable)
- PHP:
[vim.languages.php.enable](./options.html#option-vim-languages-php-enable)
- F#:
[vim.languages.fsharp.enable](./options.html#option-vim-languages-fsharp-enable)
- Assembly:
[vim.languages.assembly.enable](./options.html#option-vim-languages-assembly-enable)
- Astro:
[vim.languages.astro.enable](./options.html#option-vim-languages-astro-enable)
- Bash:
[vim.languages.bash.enable](./options.html#option-vim-languages-bash-enable)
- Clang:
[vim.languages.clang.enable](./options.html#option-vim-languages-clang-enable)
- Clojure:
[vim.languages.clojure.enable](./options.html#option-vim-languages-clojure-enable)
- C#:
[vim.languages.csharp.enable](./options.html#option-vim-languages-csharp-enable)
- CSS:
[vim.languages.css.enable](./options.html#option-vim-languages-css-enable)
- CUE:
[vim.languages.cue.enable](./options.html#option-vim-languages-cue-enable)
- Elixir:
[vim.languages.elixir.enable](./options.html#option-vim-languages-elixir-enable)
- Gleam:
[vim.languages.gleam.enable](./options.html#option-vim-languages-gleam-enable)
- HCL:
[vim.languages.hcl.enable](./options.html#option-vim-languages-hcl-enable)
- Helm:
[vim.languages.helm.enable](./options.html#option-vim-languages-helm-enable)
- Julia:
[vim.languages.julia.enable](./options.html#option-vim-languages-julia-enable)
- Kotlin:
[vim.languages.kotlin.enable](./options.html#option-vim-languages-kotlin-enable)
- Nim:
[vim.languages.nim.enable](./options.html#option-vim-languages-nim-enable)
- Nu: [vim.languages.nu.enable](./options.html#option-vim-languages-nu-enable)
- OCaml:
[vim.languages.ocaml.enable](./options.html#option-vim-languages-ocaml-enable)
- Odin:
[vim.languages.odin.enable](./options.html#option-vim-languages-odin-enable)
- R: [vim.languages.r.enable](./options.html#option-vim-languages-r-enable)
- Ruby:
[vim.languages.ruby.enable](./options.html#option-vim-languages-ruby-enable)
- Scala:
[vim.languages.scala.enable](./options.html#option-vim-languages-scala-enable)
- Svelte:
[vim.languages.svelte.enable](./options.html#option-vim-languages-svelte-enable)
- Tailwind:
[vim.languages.tailwind.enable](./options.html#option-vim-languages-tailwind-enable)
- Terraform:
[vim.languages.terraform.enable](#opt-vim.languages.terraform.enable)
- Typst: [vim.languages.typst.enable](#opt-vim.languages.typst.enable)
- Vala: [vim.languages.vala.enable](#opt-vim.languages.vala.enable)
- WGSL: [vim.languages.wgsl.enable](#opt-vim.languages.wgsl.enable)
- YAML: [vim.languages.yaml.enable](#opt-vim.languages.yaml.enable)
[vim.languages.terraform.enable](./options.html#option-vim-languages-terraform-enable)
- Typst:
[vim.languages.typst.enable](./options.html#option-vim-languages-typst-enable)
- Vala:
[vim.languages.vala.enable](./options.html#option-vim-languages-vala-enable)
- WGSL:
[vim.languages.wgsl.enable](./options.html#option-vim-languages-wgsl-enable)
- YAML:
[vim.languages.yaml.enable](./options.html#option-vim-languages-yaml-enable)

Adding support for more languages, and improving support for existing ones are
great places where you can contribute with a PR.
Expand Down
Loading
Loading