nix-community.nixvim/wrappers/_shared.nix
traxys 5a498edd14
modules/output: Allow to specify text to add as extra files (#343)
To enable some features (like adding tree-sitter queries) we need to add
files to specific directories in the runtime path (queries/lang/file.scm
for tree-sitter queries for example).

This commit adds support for specifying such files. You must be careful
to not have any collisions between `files` and `extraFiles`.
2023-04-21 20:04:58 +02:00

49 lines
998 B
Nix

modules: {
lib,
pkgs,
config,
...
}: let
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
in {
topLevelModules =
[
./modules/output.nix
(import ./modules/files.nix (modules pkgs))
]
++ (modules pkgs);
helpers = mkOption {
type = mkOptionType {
name = "helpers";
description = "Helpers that can be used when writing nixvim configs";
check = builtins.isAttrs;
};
description = "Use this option to access the helpers";
default = import ../plugins/helpers.nix {inherit (pkgs) lib;};
};
configFiles = let
cfg = config.programs.nixvim;
in
(
lib.mapAttrs'
(
_: file:
lib.nameValuePair
"nvim/${file.path}"
{text = file.content;}
)
cfg.files
)
// (
lib.mapAttrs'
(
path: content:
lib.nameValuePair
"nvim/${path}"
{text = content;}
)
cfg.extraFiles
);
}