Skip to content

Commit

Permalink
docs: use README as a source for the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSturgeon committed Jan 19, 2025
1 parent ab693bb commit 1654f97
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
- [Quick set up tutorial](https://www.youtube.com/watch?v=b641h63lqy0) (by [@Vimjoyer](https://www.youtube.com/@vimjoyer))
- [Nixvim: How to configure Neovim with the power of Nix](https://www.youtube.com/watch?v=GOe0C7Qtypk) (NeovimConf 2023 talk by [@GaetanLepage](https://glepage.com/))

<!-- START DOCS -->

## What is it?
NixVim is a [Neovim](https://neovim.io) distribution built around
[Nix](https://nixos.org) modules. It is distributed as a Nix flake, and
Expand All @@ -37,6 +39,8 @@ catppuccin as the colorscheme, no extra configuration required!

Check out [this list of real world nixvim configs](https://nix-community.github.io/nixvim/user-guide/config-examples.html)!

<!-- STOP DOCS -->

## How does it work?
When you build the module (probably using home-manager), it will install all
your plugins and generate a lua config for NeoVim with all the options
Expand Down
16 changes: 16 additions & 0 deletions docs/mdbook/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
# Patch index.md
substituteInPlace ./index.md \
--replace-fail "@README@" "$(cat ${finalAttrs.passthru.readme})" \
--replace-fail "@DOCS_VERSIONS@" "$(cat ${finalAttrs.passthru.docs-versions})"
# Patch user-configs
Expand All @@ -369,6 +370,21 @@ pkgs.stdenv.mkDerivation (finalAttrs: {

passthru = {
copy-docs = pkgs.writeShellScript "copy-docs" docs.commands;
readme =
runCommand "readme"
{
start = "<!-- START DOCS -->";
end = "<!-- STOP DOCS -->";
baseurl = "https://nix-community.github.io/nixvim/";
src = ../../README.md;
}
''
# extract relevant section of the README
sed -n "/$start/,/$end/p" $src > $out
# replace absolute links
substituteInPlace $out --replace-quiet "$baseurl" "./"
# TODO: replace .html with .md
'';
search = search.override {
baseHref = finalAttrs.baseHref + "search/";
};
Expand Down
25 changes: 1 addition & 24 deletions docs/mdbook/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,7 @@ Documentation is currently available for the following versions:
>
> The old behaviour can be restored by enabling `nixpkgs.useGlobalPackages`.
## What is it?
NixVim is a [Neovim](https://neovim.io) distribution built around
[Nix](https://nixos.org) modules. It is distributed as a Nix flake, and
configured through Nix, all while leaving room for your plugins and your vimrc.

## What does it look like?
Here is a simple configuration that uses catppuccin as the colorscheme and uses the
lualine plugin:

```nix
{
programs.nixvim = {
enable = true;
colorschemes.catppuccin.enable = true;
plugins.lualine.enable = true;
};
}
```

When we do this, lualine will be set up to a sensible default, and will use
catppuccin as the colorscheme, no extra configuration required!

Check out [this list of real world nixvim configs](./user-guide/config-examples.md)!
@README@

## Welcome to the docs!

Expand Down

0 comments on commit 1654f97

Please sign in to comment.