From 654381910b9cffdab49033e3a097944e72678c00 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Sun, 6 Oct 2024 01:04:02 -0400 Subject: [PATCH] Added instructions on creating multiple configurations in home-manager --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index d2bae7f..9dc7a89 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,31 @@ The default configuration performs editing without settings for any particular l - Python `nix run github:fred-drake/neovim#python` - Javascript `nix run github:fred-drake/neovim#javascript` +### Install Multiple Configurations + +You can have multiple neovim configurations (`nvim`, `nvim-rust`, `nvim-golang`, etc). Take a look at my [system configuration flake](https://github.com/fred-drake/nix/blob/main/flake.nix) to see how I do this, but here's the gist: + +Create a function that creates neovim links with unique configuration names: + +```nix + mkNeovimPackages = pkgs: neovimPkgs: let + mkNeovimAlias = name: pkg: + pkgs.runCommand "neovim-${name}" {} '' + mkdir -p $out/bin + ln -s ${pkg}/bin/nvim $out/bin/nvim-${name} + ''; +``` + +And add it to your home-manager imports: + +```nix + ({pkgs, ...}: { + home.packages = + (builtins.attrValues (mkNeovimPackages pkgs inputs.neovim.packages.${pkgs.system})) + ++ [inputs.neovim.packages.${pkgs.system}.default]; + }) +``` + ## Technology Support | Technology | Formatter | Language Server | Debugger | Nix Configuration |