Skip to content

Commit bce9798

Browse files
authored
Merge pull request #55 from tsandrini/updates
feat(nixvim): add otter, spectre, render-markdown
2 parents bbba669 + 3915c84 commit bce9798

File tree

14 files changed

+327
-28
lines changed

14 files changed

+327
-28
lines changed

README.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
1. [Troubleshooting](5-troubleshooting)
1717
1. [`Write error: disk full;` during `nixos-install`](write-error-disk-full-during-nixos-install)
1818
1. [Impurities](6-impurities)
19-
1. [References](7-references)
19+
1. [Currently known impurities](61-currently-known-impurities)
20+
1. [Notes](62-notes)
21+
1. [Resources](7-resources)
22+
1. [Credits & Special thanks](8-credits-special-thanks)
23+
1. [Major help](81-major-help)
24+
1. [Additional help](82-additional-help)
2025

2126
## 1. About ❄️
2227

@@ -136,9 +141,23 @@ mount -o remount,size=15G /tmp
136141

137142
## 6. Impurities 💩
138143

139-
- Currently **none**! 🚀🚀
144+
I heavily dislike using the `--impure` flag, which is unfortunately required
145+
in certain use cases, and I go really out of my way to patch stuff and
146+
avoid using it.
140147

141-
## 7. References 📚
148+
### 6.1 Currently known impurities
149+
150+
- **none**! 🚀🚀
151+
152+
### 6.2 Notes
153+
154+
- [shadow-nix](https://github.com/NicolasGuilloux/shadow-nix) and all its
155+
forks rely on impure imports of hashes, so I am maintaining my own fork
156+
[tsandrini/shadow-nix](https://github.com/tsandrini/shadow-nix)
157+
- I was previously using [devenv](https://devenv.sh/), however, it still doesn't
158+
work really well in a pure mode, so switched to a simple devshell instead.
159+
160+
## 7. Resources 📚
142161

143162
The whole nix ecosystem is in its foundations a revolutionary piece of
144163
software and once you get the hang of it you feel like you’ve really
@@ -164,3 +183,33 @@ manual.org?)
164183
- [Github code search: thanks to how the nix lang works the code search should be of a huge help, included an example](https://github.com/search?q=pkgs.writeShellScriptBin+language%3ANix&type=code&l=Nix)
165184
- [This is where flake-parts finally clicked for me, huge thanks to viperml~~](https://github.com/viperML/dotfiles)
166185
- [dc-tec/nixvim awesome nixvim config that got me started](https://github.com/dc-tec/nixvim/)
186+
187+
## 8. Credits & Special thanks
188+
189+
To reiterate the previous [Resources](7-resources) section, here are also some
190+
explicit shoutouts & thanks to the people from whom I have at some point in time
191+
taken some piece of code or have been inspired from. Huge thanks ❤️
192+
193+
### 8.1 Major help
194+
195+
These are people that are engrained in the nix community and whose work I/we
196+
use on a daily basis. I hope they will happily continue to be a part of the
197+
nix community and I thank them for all of their contributions.
198+
199+
[edolstra](https://github.com/edolstra)
200+
-- [grahamc](https://github.com/grahamc)
201+
-- [domenkozar](https://github.com/domenkozar)
202+
-- [Mic92](https://github.com/Mic92)
203+
-- [hlissner](https://github.com/hlissner)
204+
-- [viperML](https://github.com/viperML)
205+
-- [roberth](https://github.com/roberth)
206+
-- [fufexan](https://github.com/fufexan)
207+
-- [NobbZ](https://github.com/NobbZ)
208+
209+
### 8.2 Additional help
210+
211+
Additional help with certain specific areas, inspiration or code snippets.
212+
213+
[balsoft](https://github.com/balsoft)
214+
-- [dc-tec](https://github.com/dc-tec)
215+
-- [notusknot](https://github.com/notusknot/)

flake-parts/hosts/jetbundle/default.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,13 @@
138138
# NOTE for wireguard
139139
networking.wireguard.enable = true;
140140
networking.firewall = {
141-
allowedUDPPorts = [ 51820 ];
141+
allowedUDPPorts = [
142+
51820
143+
4321
144+
];
145+
allowedTCPPorts = [
146+
4321
147+
];
142148
};
143149

144150
# If you intend to route all your traffic through the wireguard tunnel, the

flake-parts/modules/nixvim/default.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ in
5353
};
5454

5555
plugins_editor_bufferline = importApply ./plugins/editor/bufferline.nix { inherit localFlake; };
56+
plugins_editor_spectre = importApply ./plugins/editor/spectre.nix { inherit localFlake; };
5657
plugins_editor_copilot-lua = importApply ./plugins/editor/copilot-lua.nix { inherit localFlake; };
5758
plugins_editor_neo-tree = importApply ./plugins/editor/neo-tree.nix { inherit localFlake; };
5859
plugins_editor_noice = importApply ./plugins/editor/noice.nix { inherit localFlake; };
5960
plugins_editor_treesitter = importApply ./plugins/editor/treesitter.nix { inherit localFlake; };
6061
plugins_editor_undotree = importApply ./plugins/editor/undotree.nix { inherit localFlake; };
62+
plugins_editor_render-markdown = importApply ./plugins/editor/render-markdown.nix {
63+
inherit localFlake;
64+
};
6165

6266
plugins_cmp_cmp = importApply ./plugins/cmp/cmp.nix { inherit localFlake; };
6367
plugins_cmp_lspkind = importApply ./plugins/cmp/lspkind.nix { inherit localFlake; };
@@ -68,5 +72,6 @@ in
6872
plugins_lsp_lsp = importApply ./plugins/lsp/lsp.nix { inherit localFlake; };
6973
plugins_lsp_lspsaga = importApply ./plugins/lsp/lspsaga.nix { inherit localFlake; };
7074
plugins_lsp_trouble = importApply ./plugins/lsp/trouble.nix { inherit localFlake; };
75+
plugins_lsp_otter = importApply ./plugins/lsp/otter.nix { inherit localFlake; };
7176
};
7277
}

flake-parts/modules/nixvim/neovide.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ in
4747
end
4848
4949
map("n", "<C-=>", function()
50-
neovideScale(0.1)
50+
neovideScale(0.05)
5151
end)
5252
5353
map("n", "<C-->", function()
54-
neovideScale(-0.1)
54+
neovideScale(-0.05)
5555
end)
5656
5757
vim.g.neovide_transparency = 0.92
58-
neovideScale(-0.3)
58+
neovideScale(-0.35)
5959
end
6060
'';
6161
}

flake-parts/modules/nixvim/plugins/cmp/cmp.nix

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@
2121
}:
2222
let
2323
inherit (lib) mkIf mkMerge mkEnableOption;
24-
inherit (localFlake.lib.modules) mkOverrideAtNixvimModuleLevel;
24+
inherit (localFlake.lib.modules)
25+
mkOverrideAtNixvimModuleLevel
26+
mkOverrideAtNixvimProfileLevel
27+
isModuleLoadedAndEnabled
28+
;
2529

2630
cfg = config.tensorfiles.nixvim.plugins.cmp.cmp;
2731
_ = mkOverrideAtNixvimModuleLevel;
2832

33+
copilot-lua-check = isModuleLoadedAndEnabled config "tensorfiles.nixvim.plugins.editor.copilot-lua";
34+
2935
get_bufnrs.__raw = ''
3036
function()
3137
local buf_size_limit = 1024 * 1024 -- 1MB size limit
@@ -53,6 +59,16 @@ in
5359
// {
5460
default = true;
5561
};
62+
63+
copilot-cmp = {
64+
enable =
65+
mkEnableOption ''
66+
Enable the copilot-cmp integration.
67+
''
68+
// {
69+
default = true;
70+
};
71+
};
5672
};
5773

5874
config = mkIf cfg.enable (mkMerge [
@@ -106,20 +122,23 @@ in
106122
{
107123
name = "nvim_lsp";
108124
priority = 1100;
125+
# group_index = 2;
109126
option = {
110127
inherit get_bufnrs;
111128
};
112129
}
113130
{
114131
name = "nvim_lsp_signature_help";
115132
priority = 1000;
133+
# group_index = 2;
116134
option = {
117135
inherit get_bufnrs;
118136
};
119137
}
120138
{
121139
name = "nvim_lsp_document_symbol";
122140
priority = 1000;
141+
# group_index = 2;
123142
option = {
124143
inherit get_bufnrs;
125144
};
@@ -181,6 +200,26 @@ in
181200
};
182201
}
183202
# |----------------------------------------------------------------------| #
203+
(mkIf (cfg.copilot-cmp.enable && copilot-lua-check) {
204+
plugins.copilot-lua = {
205+
suggestion.enabled = mkOverrideAtNixvimProfileLevel false;
206+
panel.enabled = mkOverrideAtNixvimProfileLevel false;
207+
};
208+
209+
plugins.cmp.settings = {
210+
sources = [
211+
{
212+
name = "copilot";
213+
priority = 1200;
214+
# group_index = 2;
215+
option = {
216+
inherit get_bufnrs;
217+
};
218+
}
219+
];
220+
};
221+
})
222+
# |----------------------------------------------------------------------| #
184223
]);
185224

186225
meta.maintainers = with localFlake.lib.maintainers; [ tsandrini ];

flake-parts/modules/nixvim/plugins/editor/copilot-lua.nix

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ in
4141
{
4242
plugins.copilot-lua = {
4343
enable = _ true;
44-
suggestion.autoTrigger = _ true;
45-
copilotNodeCommand = _ "node";
44+
# package = _ patched-copilot-lua;
45+
suggestion = {
46+
enabled = _ true;
47+
autoTrigger = _ true;
48+
};
49+
# filetypes = {
50+
# "*" = true;
51+
# };
52+
# copilotNodeCommand = _ "node";
4653
};
4754
}
4855
# |----------------------------------------------------------------------| #
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# --- flake-parts/modules/nixvim/plugins/editor/render-markdown.nix
2+
#
3+
# Author: tsandrini <tomas.sandrini@seznam.cz>
4+
# URL: https://github.com/tsandrini/tensorfiles
5+
# License: MIT
6+
#
7+
# 888 .d888 d8b 888
8+
# 888 d88P" Y8P 888
9+
# 888 888 888
10+
# 888888 .d88b. 88888b. .d8888b .d88b. 888d888 888888 888 888 .d88b. .d8888b
11+
# 888 d8P Y8b 888 "88b 88K d88""88b 888P" 888 888 888 d8P Y8b 88K
12+
# 888 88888888 888 888 "Y8888b. 888 888 888 888 888 888 88888888 "Y8888b.
13+
# Y88b. Y8b. 888 888 X88 Y88..88P 888 888 888 888 Y8b. X88
14+
# "Y888 "Y8888 888 888 88888P' "Y88P" 888 888 888 888 "Y8888 88888P'
15+
{ localFlake }:
16+
{
17+
config,
18+
lib,
19+
pkgs,
20+
...
21+
}:
22+
let
23+
inherit (lib)
24+
mkIf
25+
mkMerge
26+
mkEnableOption
27+
;
28+
# inherit (localFlake.lib.modules) mkOverrideAtNixvimModuleLevel;
29+
30+
cfg = config.tensorfiles.nixvim.plugins.editor.render-markdown;
31+
# _ = mkOverrideAtNixvimModuleLevel;
32+
33+
in
34+
{
35+
options.tensorfiles.nixvim.plugins.editor.render-markdown = {
36+
enable = mkEnableOption ''
37+
TODO
38+
'';
39+
};
40+
41+
config = mkIf cfg.enable (mkMerge [
42+
# |----------------------------------------------------------------------| #
43+
{
44+
extraPlugins = with pkgs.vimPlugins; [
45+
render-markdown
46+
];
47+
48+
extraConfigLua = ''
49+
require('render-markdown').setup()
50+
'';
51+
}
52+
# |----------------------------------------------------------------------| #
53+
]);
54+
55+
meta.maintainers = with localFlake.lib.maintainers; [ tsandrini ];
56+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# --- flake-parts/modules/nixvim/plugins/editor/spectre.nix
2+
#
3+
# Author: tsandrini <tomas.sandrini@seznam.cz>
4+
# URL: https://github.com/tsandrini/tensorfiles
5+
# License: MIT
6+
#
7+
# 888 .d888 d8b 888
8+
# 888 d88P" Y8P 888
9+
# 888 888 888
10+
# 888888 .d88b. 88888b. .d8888b .d88b. 888d888 888888 888 888 .d88b. .d8888b
11+
# 888 d8P Y8b 888 "88b 88K d88""88b 888P" 888 888 888 d8P Y8b 88K
12+
# 888 88888888 888 888 "Y8888b. 888 888 888 888 888 888 88888888 "Y8888b.
13+
# Y88b. Y8b. 888 888 X88 Y88..88P 888 888 888 888 Y8b. X88
14+
# "Y888 "Y8888 888 888 88888P' "Y88P" 888 888 888 888 "Y8888 88888P'
15+
{ localFlake }:
16+
{
17+
config,
18+
lib,
19+
...
20+
}:
21+
let
22+
inherit (lib)
23+
mkIf
24+
mkMerge
25+
mkEnableOption
26+
;
27+
inherit (localFlake.lib.modules) mkOverrideAtNixvimModuleLevel;
28+
29+
cfg = config.tensorfiles.nixvim.plugins.editor.spectre;
30+
_ = mkOverrideAtNixvimModuleLevel;
31+
in
32+
{
33+
options.tensorfiles.nixvim.plugins.editor.spectre = {
34+
enable = mkEnableOption ''
35+
TODO
36+
'';
37+
38+
withKeymaps =
39+
mkEnableOption ''
40+
Enable the related included keymaps.
41+
''
42+
// {
43+
default = true;
44+
};
45+
};
46+
47+
config = mkIf cfg.enable (mkMerge [
48+
# |----------------------------------------------------------------------| #
49+
{
50+
plugins.spectre = {
51+
enable = _ true;
52+
};
53+
}
54+
# |----------------------------------------------------------------------| #
55+
(mkIf cfg.withKeymaps {
56+
keymaps = [
57+
{
58+
mode = "n";
59+
key = "<leader>R";
60+
action = "<cmd>Spectre<CR>";
61+
options = {
62+
silent = true;
63+
desc = "Search & Replace";
64+
};
65+
}
66+
];
67+
})
68+
# |----------------------------------------------------------------------| #
69+
]);
70+
71+
meta.maintainers = with localFlake.lib.maintainers; [ tsandrini ];
72+
}

0 commit comments

Comments
 (0)