-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.nix
executable file
·73 lines (68 loc) · 1.44 KB
/
lib.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
{ nixpkgs }:
let
inherit (nixpkgs) lib;
# flattenDerivations :: AttrSet -> [ Derivation ]
flattenDerivations =
attrset:
lib.lists.flatten (
lib.mapAttrsToList (
_name: value:
if lib.attrsets.isDerivation value then
[ value ]
else if builtins.isAttrs value then
flattenDerivations value
else
[ ]
) attrset
);
toLua = lib.generators.toLua { };
inherit (lib.generators) mkLuaInline;
defaultLazyOpts = {
root = mkLuaInline ''vim.fn.stdpath("data") .. "/lazy"'';
lockfile = mkLuaInline ''vim.fn.stdpath("config") .. "/lazy-lock.json"'';
state = mkLuaInline ''vim.fn.stdpath("state") .. "/lazy/state.json"'';
install = {
missing = false;
colorscheme = [ "habamax" ];
};
checker = {
enabled = false;
notify = false;
};
change_detection = {
enabled = false;
notify = false;
};
performance = {
reset_packpath = true;
rtp = {
reset = true;
};
};
readme = {
enabled = false;
};
};
setupLazyLua =
{
pkgs,
spec ? [ ],
opts ? { },
}:
let
lazypath = (pkgs.callPackage ./plugins.nix { })."lazy.nvim";
in
''
vim.opt.rtp:prepend("${lazypath}");
require("lazy").setup(${toLua spec}, ${toLua opts})
'';
in
{
inherit
defaultLazyOpts
flattenDerivations
mkLuaInline
setupLazyLua
toLua
;
}