~toastal/nvim-tree-sitter-unicode-conceal

~toastal/nvim-tree-sitter-unicode-conceal/flake.nix
 ..
0 {
1 description = "Neovim plugin for Unicode character conceal by way of tree-sitter";
2
3 inputs = {
4 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5 };
6
7 outputs =
8 { self, nixpkgs, ... }@inputs:
9 let
10 name = "nvim-tree-sitter-unicode-conceal";
11
12 # neovim ∪ tree-sitter
13 supportedSystems = [
14 "aarch64-linux"
15 "i686-linux"
16 "x86_64-linux"
17 "aarch64-darwin"
18 "x86_64-darwin"
19 ];
20
21 nixpkgsFor = nixpkgs.lib.genAttrs supportedSystems (
22 system:
23 import nixpkgs {
24 inherit system;
25 config = { };
26 overlays = [ self.overlays.tooling ];
27 }
28 );
29
30 forAllSystems =
31 fn:
32 nixpkgs.lib.genAttrs supportedSystems (
33 system:
34 fn rec {
35 inherit system;
36 pkgs = nixpkgsFor.${system};
37 inherit (pkgs) lib;
38 fs = lib.fileset;
39 }
40 );
41 in
42 {
43 overlays = {
44 vimPlugins = final: prev: {
45 vimPlugins = prev.vimPlugins // {
46 ${name} = self.packages.${prev.system}.${name};
47 };
48 };
49
50 tooling = final: prev: {
51 nixfmt-3-space = prev.nixfmt-rfc-style.overrideAttrs (
52 finalAttrs: prevAttrs: {
53 name = "nixfmt-3-space";
54 patches = (prev.patches or [ ]) ++ [
55 (final.fetchpatch {
56 url = "https://codeberg.org/toastal/nixfmt/commit/8217f229e04b9ce68fcc5018fce650ca58525db9.patch";
57 hash = "sha256-N8O23sOI/jen7hXND+JgQlyOImI0happ7AUAaxic93k=";
58 })
59 (final.fetchpatch {
60 url = "https://codeberg.org/toastal/nixfmt/commit/4b15a8a67fd6f1cfc0df61ced9df9f14e7413b90.patch";
61 hash = "sha256-G8kYM6ojvWkwG+WguiNWwc7C3r8bPOAkfuCFXCLEj6o=";
62 })
63 ];
64 }
65 );
66 };
67 };
68
69 packages = forAllSystems (
70 {
71 system,
72 pkgs,
73 lib,
74 fs,
75 ...
76 }:
77 {
78 default = self.packages.${system}.${name};
79
80 ${name} = pkgs.vimUtils.buildVimPlugin {
81 inherit name;
82 namePrefix = "";
83 src = fs.toSource {
84 root = ./.;
85 fileset = fs.unions [
86 ./after
87 ./COPYING.txt
88 ./COPYING.LESSER.txt
89 ];
90 };
91 meta = {
92 license = with lib.licenses; [ lgpl21 ];
93 };
94 };
95
96 nvim-mod = pkgs.neovim.override {
97 configure = {
98 packages.myPlugins = with pkgs.vimPlugins; {
99 start = [
100 lsp_lines-nvim
101 trouble-nvim
102 (nvim-treesitter.withPlugins (
103 plugins: with plugins; [
104 erlang
105 fish
106 haskell
107 lua
108 nickel
109 nix
110 ocaml
111 ocaml-interface
112 php
113 ]
114 ))
115 self.packages."${system}"."${name}"
116 ];
117 };
118 customRC = # vim
119 ''
120 syntax off
121 set tabstop=4
122 set shiftwidth=4
123 set conceallevel=2
124 let mapleader=' '
125 let maplocalleader='-'
126 highlight Normal gui=NONE guifg=NONE guibg=NONE guisp=NONE cterm=NONE ctermfg=NONE ctermbg=NONE
127
128 autocmd BufNewFile,BufRead *.ncl setfiletype nickel
129 autocmd BufNewFile,BufRead *.nix setfiletype nix
130
131 lua <<EOF
132 require('nvim-treesitter.configs').setup({
133 highlight = {
134 enable = true,
135 },
136 })
137 require("lsp_lines").setup()
138 require("trouble").setup({
139 height = 9,
140 fold_open = "▶",
141 fold_close = "▼",
142 padding = false,
143 auto_close = true,
144 signs = {
145 error = "☠",
146 warning = "‼",
147 hint = "✽",
148 information = "ℹ",
149 other = "⁇",
150 },
151 use_diagnostic_signs = true,
152 })
153
154 vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>",
155 {silent = true, noremap = true}
156 )
157 vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>",
158 {silent = true, noremap = true}
159 )
160 vim.keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>",
161 {silent = true, noremap = true}
162 )
163 vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>",
164 {silent = true, noremap = true}
165 )
166 vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>",
167 {silent = true, noremap = true}
168 )
169 vim.keymap.set("n", "gR", "<cmd>TroubleToggle lsp_references<cr>",
170 {silent = true, noremap = true}
171 )
172 EOF
173 '';
174 };
175 };
176 }
177 );
178
179 apps = forAllSystems (
180 {
181 system,
182 pkgs,
183 lib,
184 ...
185 }:
186 {
187 default = self.apps.${system}.nvim-mod;
188
189 nvim-mod = {
190 type = "app";
191 program = lib.getExe self.packages.${system}.nvim-mod;
192 };
193 }
194 );
195
196 devShells = forAllSystems (
197 { system, pkgs, ... }:
198 {
199 ${name} = pkgs.mkShellNoCC {
200 inherit name;
201 buildInputs = with pkgs; [
202 nixfmt-3-space
203 topiary
204 ];
205 };
206
207 default = self.devShells.${system}.${name};
208 }
209 );
210
211 formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-3-space);
212 };
213 }