stylix/modules/vim/hm.nix
Bernardo Meurer b42555850b
Move all templates into flake inputs (#165)
This reduces our reliance on import-from-derivation, so evaluation is faster.
2023-10-10 10:44:54 +01:00

42 lines
902 B
Nix

{ pkgs, config, lib, ... }:
with lib;
let
themeFile = config.lib.stylix.colors {
templateRepo = config.lib.stylix.templates.base16-vim;
};
themePlugin = pkgs.vimUtils.buildVimPlugin {
name = "stylix";
pname = "stylix";
src = themeFile;
dontUnpack = true;
buildPhase = ''
install -D $src $out/colors/base16-stylix.vim
'';
};
vimOptions = let
fonts = config.stylix.fonts;
in {
plugins = [ themePlugin ];
extraConfig = ''
set termguicolors
colorscheme base16-stylix
unlet g:colors_name
set guifont=${escape [" "] fonts.monospace.name}:h${toString fonts.sizes.terminal}
'';
};
in {
options.stylix.targets.vim.enable =
config.lib.stylix.mkEnableTarget "Vim and/or Neovim" true;
config = lib.mkIf config.stylix.targets.vim.enable {
programs.vim = vimOptions;
programs.neovim = vimOptions;
};
}