2024-07-02 13:30:29 +01:00
|
|
|
helpers:
|
|
|
|
{ lib, config, ... }:
|
2023-02-20 11:42:13 +01:00
|
|
|
let
|
2024-07-07 16:09:31 +01:00
|
|
|
inherit (lib)
|
|
|
|
isAttrs
|
|
|
|
listToAttrs
|
|
|
|
map
|
|
|
|
mkOption
|
|
|
|
mkOptionType
|
|
|
|
;
|
2024-07-02 13:30:29 +01:00
|
|
|
cfg = config.programs.nixvim;
|
2024-07-07 16:09:31 +01:00
|
|
|
extraFiles = lib.filter (file: file.enable) (lib.attrValues cfg.extraFiles);
|
2023-02-20 11:42:13 +01:00
|
|
|
in
|
|
|
|
{
|
2023-01-24 01:28:01 +00:00
|
|
|
helpers = mkOption {
|
|
|
|
type = mkOptionType {
|
|
|
|
name = "helpers";
|
|
|
|
description = "Helpers that can be used when writing nixvim configs";
|
2024-07-07 16:09:31 +01:00
|
|
|
check = isAttrs;
|
2023-01-24 01:28:01 +00:00
|
|
|
};
|
|
|
|
description = "Use this option to access the helpers";
|
2024-02-07 16:50:08 +01:00
|
|
|
default = helpers;
|
2023-01-24 01:28:01 +00:00
|
|
|
};
|
2023-04-20 22:41:37 +02:00
|
|
|
|
2024-07-07 16:09:31 +01:00
|
|
|
# extraFiles, but nested under "nvim/" for use in etc/xdg config
|
|
|
|
configFiles = listToAttrs (
|
|
|
|
map (
|
|
|
|
{ target, source, ... }:
|
|
|
|
{
|
|
|
|
name = "nvim/" + target;
|
|
|
|
value = {
|
|
|
|
inherit source;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
) extraFiles
|
|
|
|
);
|
2023-01-24 01:28:01 +00:00
|
|
|
}
|