From 1654f97a79455efe9e578c5b70243e8333b126eb Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sun, 19 Jan 2025 13:56:54 +0000 Subject: [PATCH] docs: use README as a source for the docs --- README.md | 4 ++++ docs/mdbook/default.nix | 16 ++++++++++++++++ docs/mdbook/index.md | 25 +------------------------ 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 03df0593..f46acab0 100644 --- a/README.md +++ b/README.md @@ -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/)) + + ## 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 @@ -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)! + + ## 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 diff --git a/docs/mdbook/default.nix b/docs/mdbook/default.nix index 4ec79d9a..3224b0e1 100644 --- a/docs/mdbook/default.nix +++ b/docs/mdbook/default.nix @@ -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 @@ -369,6 +370,21 @@ pkgs.stdenv.mkDerivation (finalAttrs: { passthru = { copy-docs = pkgs.writeShellScript "copy-docs" docs.commands; + readme = + runCommand "readme" + { + start = ""; + end = ""; + 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/"; }; diff --git a/docs/mdbook/index.md b/docs/mdbook/index.md index 68413126..66a65022 100644 --- a/docs/mdbook/index.md +++ b/docs/mdbook/index.md @@ -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!