modules/files: fix creating configs of vim type

This commit is contained in:
Stanislav Asunkin 2024-07-19 11:37:00 +03:00
parent daa94bd6c2
commit c9a6912be5
3 changed files with 32 additions and 17 deletions

View file

@ -2,6 +2,7 @@
name,
config,
lib,
pkgs,
helpers,
...
}:
@ -17,11 +18,12 @@
config =
let
derivationName = "nvim-" + lib.replaceStrings [ "/" ] [ "-" ] name;
writeContent = if config.type == "lua" then helpers.writeLua else pkgs.writeText;
in
{
path = lib.mkDefault name;
type = lib.mkDefault (if lib.hasSuffix ".vim" name then "vim" else "lua");
# No need to use mkDerivedConfig; this option is readOnly.
plugin = helpers.writeLua derivationName config.content;
plugin = writeContent derivationName config.content;
};
}