sloth-flake.nvim/lib/modules/runtime.nix

54 lines
1.3 KiB
Nix

{pkgs, ...}: let
inherit (pkgs) vimUtils;
inherit (pkgs.lib) fix mkOption types;
in fix (self: {
module = types.submodule {
options = {
src = mkOption {
type = with types; either path attrs;
description = "Files to include in your runtime";
example = ./my-runtime;
};
version = mkOption {
type = with types; nullOr str;
description = "Optional version of your runtime";
default = null;
example = "2025.10.16";
};
extraOptions = mkOption {
type = with types; attrsOf anything;
description = "Extra options to pass to `vimUtils.buildVimPlugin`";
default = {};
example.nvimRequireCheck = ["my-module.my-submodule"];
};
};
};
option = mkOption {
type = types.nullOr self.module;
default = null;
description = ''
Your runtime submodule. You can configure what files should be
indluded in your runtime
'';
};
mkPlugin = opts: let
inherit (opts) src version extraOptions;
in
vimUtils.buildVimPlugin (
extraOptions
// {inherit src;}
// (
if isNull version
then {name = "runtime";}
else {
pname = "runtime";
inherit version;
}
)
);
})