-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
113 lines (106 loc) · 3.53 KB
/
flake.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
norg.url = "github:nvim-neorg/tree-sitter-norg/dev";
norg-meta.url = "github:nvim-neorg/tree-sitter-norg-meta";
neorg = {
url = "github:nvim-neorg/neorg";
flake = false;
};
neorg-telescope = {
url = "github:nvim-neorg/neorg-telescope";
flake = false;
};
};
outputs = {
self,
nixpkgs,
flake-utils,
norg,
norg-meta,
neorg,
neorg-telescope,
...
}:
{
overlays.default = final: prev: let
inherit (final.lib) attrValues elem filter filterAttrs isDerivation;
in {
vimPlugins = prev.vimPlugins.extend (f: p: {
nvim-treesitter = let
norgGrammars = {
tree-sitter-norg = norg.defaultPackage.${final.system};
tree-sitter-norg-meta = norg-meta.defaultPackage.${final.system};
};
builtGrammars = (filterAttrs (_: isDerivation) p.nvim-treesitter.builtGrammars) // norgGrammars;
allGrammars = attrValues builtGrammars;
withPlugins = grammarFn:
p.nvim-treesitter.withPlugins (
_: let
plugins = grammarFn builtGrammars;
in
plugins ++ (filter (p: !(elem p plugins)) (attrValues norgGrammars))
);
withAllGrammars = withPlugins (_: allGrammars);
in
p.nvim-treesitter.overrideAttrs (a: {
passthru =
a.passthru
// {
inherit builtGrammars allGrammars withPlugins withAllGrammars;
grammarPlugins =
a.passthru.grammarPlugins
// {
norg = p.nvim-treesitter.grammarToPlugin norgGrammars.tree-sitter-norg;
norg-meta = p.nvim-treesitter.grammarToPlugin norgGrammars.tree-sitter-norg-meta;
};
};
});
lua-utils-nvim = final.vimUtils.buildVimPlugin {
inherit (prev.luaPackages.lua-utils-nvim) pname version src;
};
pathlib-nvim = final.vimUtils.buildVimPlugin {
inherit (prev.luaPackages.pathlib-nvim) pname version src;
doCheck = false;
};
neorg = final.vimUtils.buildVimPlugin {
pname = "neorg";
version = neorg.rev;
src = neorg;
dependencies = [
(f.nvim-treesitter.withPlugins (_: []))
f.lua-utils-nvim
f.nui-nvim
f.nvim-nio
f.pathlib-nvim
f.plenary-nvim
];
doCheck = false;
};
neorg-telescope = final.vimUtils.buildVimPlugin {
pname = "neorg-telescope";
version = neorg-telescope.rev;
src = neorg-telescope;
dependencies = [
f.lua-utils-nvim
f.neorg
f.plenary-nvim
f.telescope-nvim
];
};
});
};
# https://github.com/NixOS/nix/issues/5532
overlay = nixpkgs.lib.warn "`neorg-overlay.overlay` is deprecated; use `neorg-overlay.overlays.default` instead" self.overlays.default;
}
// (flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.default];
};
in {
checks = import ./tests.nix pkgs;
formatter = pkgs.alejandra;
}));
}