2024-07-05 16:48:46 +01:00
|
|
|
{
|
|
|
|
name,
|
|
|
|
config,
|
|
|
|
lib,
|
2024-07-19 11:37:00 +03:00
|
|
|
pkgs,
|
2024-07-05 16:48:46 +01:00
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
plugin = lib.mkOption {
|
|
|
|
type = lib.types.package;
|
|
|
|
description = "A derivation with the content of the file in it";
|
|
|
|
readOnly = true;
|
|
|
|
internal = true;
|
|
|
|
};
|
|
|
|
};
|
2024-07-07 16:09:31 +01:00
|
|
|
config =
|
|
|
|
let
|
|
|
|
derivationName = "nvim-" + lib.replaceStrings [ "/" ] [ "-" ] name;
|
2024-09-12 14:56:36 +01:00
|
|
|
writeContent =
|
|
|
|
if config.type == "lua" then lib.nixvim.builders.writeLuaWith pkgs else pkgs.writeText;
|
2024-07-07 16:09:31 +01:00
|
|
|
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.
|
2024-07-19 11:37:00 +03:00
|
|
|
plugin = writeContent derivationName config.content;
|
2024-07-07 16:09:31 +01:00
|
|
|
};
|
2024-07-05 16:48:46 +01:00
|
|
|
}
|