---
title: Making nix-colors talk to neovim
date: 2023-08-18
tags:
  - nix-colors
  - neovim
  - nixos
  - home-manager
draft: false
---

I recently started fiddling around with home-managerifying my neovim config.
After moving across most of my stuff I came across the problem of how to hook things up with with [nix-colors](https://github.com/misterio77/nix-colors) so that my neovim theme would follow color changes in home-manager.
<!--more-->

Luckily, I came across [this](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-base16.md) handy little plugin from the lovely [mini.nvim](https://github.com/echasnovski/mini.nvim) suite of plugins which lets you create your own theme with your custom colors.

Beneath is a little snippet of how you could make it all happen.

```nix
{ inputs, pkgs, ... }: {
  imports = [
    inputs.nix-colors.homeManagerModules.default
  ];
  scheme = inputs.nix-colors.schemes.onedark;
  programs.neovim = {
    enable = true;
    plugins = with pkgs.vimPlugins; [
      {
        plugin = mini-nvim;
        config = ''
          lua << END
            require('mini.base16').setup({
              palette = {
                base00 = '#${scheme.colors.base00}',
                base01 = '#${scheme.colors.base01}',   
                base02 = '#${scheme.colors.base02}',    
                base03 = '#${scheme.colors.base03}',    
                base04 = '#${scheme.colors.base04}',    
                base05 = '#${scheme.colors.base05}',
                base06 = '#${scheme.colors.base06}',    
                base07 = '#${scheme.colors.base07}',    
                base08 = '#${scheme.colors.base08}',    
                base09 = '#${scheme.colors.base09}',   
                base0A = '#${scheme.colors.base0A}',    
                base0B = '#${scheme.colors.base0B}',    
                base0C = '#${scheme.colors.base0C}',   
                base0D = '#${scheme.colors.base0D}',
                base0E = '#${scheme.colors.base0E}',
                base0F = '#${scheme.colors.base0F}',    
              },
            })
          END
        '';
      }
    ];
  };
}
```

Happy theming!
