Example
The following is an example of using the library to document the programs.neovim
options from NixOS.
Base files
This document is created simply by loading the Vue component with the data from the loader. Please read the documentation.
<!-- index.md -->
## Title
Some text
<script setup>
import { data } from "./nixos.data.js";
import { RenderDocs } from "easy-nix-documentation";
</script>
## Options
<RenderDocs :options="data" />
// nixos.data.ts
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { loadOptions, stripNixStore } from "easy-nix-documentation/loader"
export default {
async load() {
const __dirname = dirname(fileURLToPath(import.meta.url));
return await loadOptions(`-f ${__dirname}/example.nix optionsJSON`, {
include: [/programs\.neovim\.*/],
mapDeclarations: declaration => {
const relDecl = stripNixStore(declaration);
return `<a href="http://github.com/NixOS/nixpkgs/tree/nixos-unstable/${relDecl}"><${relDecl}></a>`
},
})
}
}
# example.nix
let
pkgs = import <nixpkgs> { };
nixos = import <nixpkgs/nixos> {
configuration = { };
};
in
pkgs.nixosOptionsDoc {
inherit (nixos) options;
}
Options
programs.neovim.configure
Generate your init file from your list of plugins and custom commands.
Neovim will then be wrapped to load nvim -u /nix/store/«hash»-vimrc
attribute set
{ }
{
customRC = ''
" here your custom configuration goes!
'';
packages.myVimPackage = with pkgs.vimPlugins; {
# loaded on launch
start = [ fugitive ];
# manually loadable by calling `:packadd $plugin-name`
opt = [ ];
};
}
programs.neovim.defaultEditor
When enabled, installs neovim and configures neovim to be the default editor using the EDITOR environment variable.
programs.neovim.enable
Whether to enable Neovim.
When enabled through this option, Neovim is wrapped to use a
configuration managed by this module. The configuration file in the
user's home directory at ~/.config/nvim/init.vim
is no longer
loaded by default.
programs.neovim.package
The neovim-unwrapped package to use.
programs.neovim.runtime
Set of files that have to be linked in runtime
.
attribute set of (submodule)
{ }
{ "ftplugin/c.vim".text = "setlocal omnifunc=v:lua.vim.lsp.omnifunc"; }
programs.neovim.runtime.<name>.enable
Whether this runtime directory should be generated. This option allows specific runtime files to be disabled.
programs.neovim.runtime.<name>.source
Path of the source file.
programs.neovim.runtime.<name>.target
Name of symlink. Defaults to the attribute name.
programs.neovim.runtime.<name>.text
Text of the file.
null or strings concatenated with "\n"
null
programs.neovim.viAlias
Symlink vi
to {command}nvim
binary.
programs.neovim.vimAlias
Symlink vim
to {command}nvim
binary.
programs.neovim.withNodeJs
Enable Node provider.
programs.neovim.withPython3
Enable Python 3 provider.
programs.neovim.withRuby
Enable Ruby provider.
services.rsnapshot.cronIntervals
Periodicity at which intervals should be run by cron. Note that the intervals also have to exist in configuration as retain options.
attribute set of string
{ }
{
daily = "50 21 * * *";
hourly = "0 * * * *";
}
services.rsnapshot.enable
Whether to enable rsnapshot backups.
services.rsnapshot.enableManualRsnapshot
Whether to enable manual usage of the rsnapshot command with this module.
services.rsnapshot.extraConfig
rsnapshot configuration option in addition to the defaults from rsnapshot and this module.
Note that tabs are required to separate option arguments, and directory names require trailing slashes.
The "extra" in the option name might be a little misleading right now, as it is required to get a functional configuration.
strings concatenated with "\n"
""
''
retains hourly 24
retain daily 365
backup /home/ localhost/
''