neovim: simplify plugin config schema
This commit is contained in:
@@ -3,11 +3,21 @@ moduleArgs@{ config, lib, pkgs, ... }:
|
|||||||
let
|
let
|
||||||
inherit (builtins) map;
|
inherit (builtins) map;
|
||||||
inherit (lib) concatMapStrings mkIf optionalString;
|
inherit (lib) concatMapStrings mkIf optionalString;
|
||||||
# this structure roughly mirrors home-manager's `programs.neovim.plugins` option
|
|
||||||
plugins = import ./plugins.nix moduleArgs;
|
plugins = import ./plugins.nix moduleArgs;
|
||||||
plugin-packages = map (p: p.plugin) plugins;
|
plugin-packages = map (p: p.plugin) plugins;
|
||||||
plugin-config-viml = concatMapStrings (p: optionalString (p.type or "" == "viml") p.config) plugins;
|
plugin-configs = concatMapStrings (p:
|
||||||
plugin-config-lua = concatMapStrings (p: optionalString (p.type or "" == "lua") p.config) plugins;
|
optionalString
|
||||||
|
(p ? config) (
|
||||||
|
if (p.type or "") == "viml" then
|
||||||
|
p.config
|
||||||
|
else
|
||||||
|
''
|
||||||
|
lua <<EOF
|
||||||
|
${p.config}
|
||||||
|
EOF
|
||||||
|
''
|
||||||
|
)
|
||||||
|
) plugins;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
sane.programs.neovim = {
|
sane.programs.neovim = {
|
||||||
@@ -36,13 +46,8 @@ in
|
|||||||
customRC = ''
|
customRC = ''
|
||||||
${builtins.readFile ./vimrc}
|
${builtins.readFile ./vimrc}
|
||||||
|
|
||||||
""""" PLUGIN CONFIG (vim)
|
""""" PLUGIN CONFIG
|
||||||
${plugin-config-viml}
|
${plugin-configs}
|
||||||
|
|
||||||
""""" PLUGIN CONFIG (lua)
|
|
||||||
lua <<EOF
|
|
||||||
${plugin-config-lua}
|
|
||||||
EOF
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
neovim-unwrapped' = with pkgs; (neovim-unwrapped.override {
|
neovim-unwrapped' = with pkgs; (neovim-unwrapped.override {
|
||||||
|
Reference in New Issue
Block a user