nix-community.nixvim/modules/top-level/files/submodule.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
719 B
Nix
Raw Permalink Normal View History

{
name,
config,
lib,
pkgs,
...
}:
{
options = {
plugin = lib.mkOption {
type = lib.types.package;
description = "A derivation with the content of the file in it";
readOnly = true;
internal = true;
};
};
config =
let
derivationName = "nvim-" + lib.replaceStrings [ "/" ] [ "-" ] name;
writeContent =
if config.type == "lua" then lib.nixvim.builders.writeLuaWith pkgs 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 = writeContent derivationName config.content;
};
}