forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_shared.nix
52 lines (50 loc) · 972 Bytes
/
_shared.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
{
modules,
helpers,
}: {
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 = helpers;
};
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
);
}