mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-11-03 20:22:21 +00:00 
			
		
		
		
	docs: restructure documentation
This commit is contained in:
		
					parent
					
						
							
								bd9eb56531
							
						
					
				
			
			
				commit
				
					
						4beab0341f
					
				
			
		
					 31 changed files with 1561 additions and 100 deletions
				
			
		
							
								
								
									
										19
									
								
								docs/manual/installation/custom-configuration.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								docs/manual/installation/custom-configuration.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
# Standalone Installation {#ch-standalone-installation}
 | 
			
		||||
 | 
			
		||||
It is possible to install neovim-flake without depending on NixOS or home-manager as the parent
 | 
			
		||||
module system, using the `neovimConfiguration` function exposed by neovim-flake extended library.
 | 
			
		||||
It takes in the configuration as a module, and returns an attribute set as a result.
 | 
			
		||||
 | 
			
		||||
```nix
 | 
			
		||||
{
 | 
			
		||||
  options = "The options that were available to configure";
 | 
			
		||||
  config = "The outputted configuration";
 | 
			
		||||
  pkgs = "The package set used to evaluate the module";
 | 
			
		||||
  neovim = "The built neovim package";
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```{=include=} chapters
 | 
			
		||||
standalone/nixos.md
 | 
			
		||||
standalone/home-manager.md
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										6
									
								
								docs/manual/installation/modules.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								docs/manual/installation/modules.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
# Module Installation {#ch-module-installation}
 | 
			
		||||
 | 
			
		||||
```{=include=} chapters
 | 
			
		||||
modules/nixos.md
 | 
			
		||||
modules/home-manager.md
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										79
									
								
								docs/manual/installation/modules/home-manager.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								docs/manual/installation/modules/home-manager.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,79 @@
 | 
			
		|||
# Home Manager Module {#ch-hm-module}
 | 
			
		||||
 | 
			
		||||
The Home Manager module allows us to customize the different `vim` options from inside the home-manager configuration
 | 
			
		||||
and it is the preferred way of configuring neovim-flake, both on NixOS and non-NixOS systems.
 | 
			
		||||
 | 
			
		||||
To use it, we first add the input flake.
 | 
			
		||||
 | 
			
		||||
```nix
 | 
			
		||||
{
 | 
			
		||||
  inputs = {
 | 
			
		||||
    obsidian-nvim.url = "github:epwalsh/obsidian.nvim";
 | 
			
		||||
    neovim-flake = {
 | 
			
		||||
      url = "github:notashelf/neovim-flake";
 | 
			
		||||
      # you can override input nixpkgs
 | 
			
		||||
      inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
      # you can also override individual plugins
 | 
			
		||||
      # for example:
 | 
			
		||||
      inputs.obsidian-nvim.follows = "obsidian-nvim"; # <- this will use the obsidian-nvim from your inputs
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Followed by importing the home-manager module somewhere in your configuration.
 | 
			
		||||
 | 
			
		||||
```nix
 | 
			
		||||
{
 | 
			
		||||
  # assuming neovim-flake is in your inputs and inputs is in the argset
 | 
			
		||||
  imports = [ inputs.neovim-flake.homeManagerModules.default ];
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
An example installation for neovim-flake under standalone home-manager
 | 
			
		||||
would look like this:
 | 
			
		||||
 | 
			
		||||
```nix
 | 
			
		||||
{
 | 
			
		||||
  inputs = {
 | 
			
		||||
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
 | 
			
		||||
    home-manager.url = "github:nix-community/home-manager";
 | 
			
		||||
    neovim-flake.url = "github:notashelf/neovim-flake";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs = { nixpkgs, home-manager, neovim-flake ... }: let
 | 
			
		||||
  system = "x86_64-linux"; in {
 | 
			
		||||
    # ↓ this is the home-manager output in the flake schema
 | 
			
		||||
    homeConfigurations."yourUsername»" = home-manager.lib.homeManagerConfiguration {
 | 
			
		||||
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
 | 
			
		||||
      modules = [
 | 
			
		||||
        neovim-flake.homeManagerModules.default # <- this imports the home-manager module that provides the options
 | 
			
		||||
        ./home.nix # your home-manager configuration, probably where you will want to add programs.neovim-flake options
 | 
			
		||||
      ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Once the module is imported, we will be able to define the following options (and much more) from inside the
 | 
			
		||||
home-manager configuration.
 | 
			
		||||
 | 
			
		||||
```nix{
 | 
			
		||||
  programs.neovim-flake = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    # your settings need to go into the settings attribute set
 | 
			
		||||
    # most settings are documented in the appendix
 | 
			
		||||
    settings = {
 | 
			
		||||
      vim.viAlias = false;
 | 
			
		||||
      vim.vimAlias = true;
 | 
			
		||||
      vim.lsp = {
 | 
			
		||||
        enable = true;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::{.note}
 | 
			
		||||
You may find all avaliable options in the [appendix](https://notashelf.github.io/neovim-flake/options)
 | 
			
		||||
:::
 | 
			
		||||
							
								
								
									
										3
									
								
								docs/manual/installation/modules/nixos.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								docs/manual/installation/modules/nixos.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
# NixOS Module {#ch-nixos-module}
 | 
			
		||||
 | 
			
		||||
This artice is a stub. It will be written as the NixOS module is finalized.
 | 
			
		||||
							
								
								
									
										37
									
								
								docs/manual/installation/standalone/home-manager.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								docs/manual/installation/standalone/home-manager.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
# Standalone Installation (home-manager) {#ch-standalone-home-manager}
 | 
			
		||||
 | 
			
		||||
The following is an example of a barebones vim configuration with the default theme enabled.
 | 
			
		||||
 | 
			
		||||
```nix
 | 
			
		||||
{
 | 
			
		||||
  inputs.neovim-flake = {
 | 
			
		||||
    url = "github:notashelf/neovim-flake";
 | 
			
		||||
    inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs = {nixpkgs, neovim-flake, ...}: let
 | 
			
		||||
    system = "x86_64-linux";
 | 
			
		||||
    pkgs = nixpkgs.legacyPackages.${system};
 | 
			
		||||
    configModule = {
 | 
			
		||||
      # Add any custom options (and feel free to upstream them!)
 | 
			
		||||
      # options = ...
 | 
			
		||||
 | 
			
		||||
      config.vim = {
 | 
			
		||||
        theme.enable = true;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    customNeovim = neovim-flake.lib.neovimConfiguration {
 | 
			
		||||
      modules = [configModule];
 | 
			
		||||
      inherit pkgs;
 | 
			
		||||
    };
 | 
			
		||||
  in {
 | 
			
		||||
    # this is an example nixosConfiguration using the built neovim package
 | 
			
		||||
    homeConfigurations = {
 | 
			
		||||
      yourHostName = home-manager.lib.nixosSystem {
 | 
			
		||||
        # TODO
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										51
									
								
								docs/manual/installation/standalone/nixos.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								docs/manual/installation/standalone/nixos.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
# Standalone Installation (NixOS) {#ch-standalone-nixos}
 | 
			
		||||
 | 
			
		||||
The following is an example of a barebones vim configuration with the default theme enabled.
 | 
			
		||||
 | 
			
		||||
```nix
 | 
			
		||||
{
 | 
			
		||||
  inputs.neovim-flake = {
 | 
			
		||||
    url = "github:notashelf/neovim-flake";
 | 
			
		||||
    inputs.nixpkgs.follows = "nixpkgs";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  outputs = {nixpkgs, neovim-flake, ...}: let
 | 
			
		||||
    system = "x86_64-linux";
 | 
			
		||||
    pkgs = nixpkgs.legacyPackages.${system};
 | 
			
		||||
    configModule = {
 | 
			
		||||
      # Add any custom options (and feel free to upstream them!)
 | 
			
		||||
      # options = ...
 | 
			
		||||
 | 
			
		||||
      config.vim = {
 | 
			
		||||
        theme.enable = true;
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    customNeovim = neovim-flake.lib.neovimConfiguration {
 | 
			
		||||
      modules = [configModule];
 | 
			
		||||
      inherit pkgs;
 | 
			
		||||
    };
 | 
			
		||||
  in {
 | 
			
		||||
    # this will make the package available as a flake input
 | 
			
		||||
    packages.${system}.neovim = customNeovim.neovim;
 | 
			
		||||
 | 
			
		||||
    # this is an example nixosConfiguration using the built neovim package
 | 
			
		||||
    nixosConfigurations = {
 | 
			
		||||
      yourHostName = nixpkgs.lib.nixosSystem {
 | 
			
		||||
        # ...
 | 
			
		||||
        modules = [
 | 
			
		||||
          ./configuration.nix # or whatever your configuration is
 | 
			
		||||
 | 
			
		||||
          # this will make wrapped neovim available in your system packages
 | 
			
		||||
          {environment.systemPackages = [customNeovim.neovim];}
 | 
			
		||||
        ];
 | 
			
		||||
        # ...
 | 
			
		||||
      };
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Your built neovim configuration can be exposed as a flake output, or be added to your system packages to make
 | 
			
		||||
it available across your system. You may also consider passing the flake output to home-manager to make it available
 | 
			
		||||
to a specific user.
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue