forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodules.nix
85 lines (83 loc) · 2.37 KB
/
modules.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{ modules, ... }:
{
_module.args = {
modules =
pkgs:
let
nixpkgsMaintainersList = pkgs.path + "/nixos/modules/misc/meta.nix";
nixvimExtraArgsModule = rec {
_file = ./flake.nix;
key = _file;
config = {
_module.args = {
pkgs = pkgs.lib.mkForce pkgs;
inherit (pkgs) lib;
};
};
};
in
[
../modules
nixpkgsMaintainersList
nixvimExtraArgsModule
(
{ lib, ... }:
with lib;
{
# Attribute may contain the following fields:
# - path: Path to the module, e.g. [ "plugins" "<name>" ]
# - description: A short description of the plugin
# - url: Url for the plugin
#
# We need to use an attrs instead of a submodule to handle the merge.
options.meta.nixvimInfo = mkOption {
type = (types.nullOr types.attrs) // {
# This will create an attrset of the form:
#
# { path.to.plugin.name = <info>; }
#
#
# Where <info> is an attrset of the form:
# {
# file = "path";
# description = null or "<DESCRIPTION>";
# url = null or "<URL>";
# }
merge =
_: defs:
lib.foldl'
(
acc: def:
lib.recursiveUpdate acc (
setAttrByPath def.value.path {
inherit (def) file;
url = def.value.url or null;
description = def.value.description or null;
}
)
)
{
plugins = { };
colorschemes = { };
}
defs;
};
internal = true;
default = null;
description = ''
Nixvim related information on the module
'';
};
}
)
];
};
perSystem =
{ pkgs, config, ... }:
{
_module.args = {
modules = modules pkgs;
rawModules = modules;
};
};
}