diff --git a/README.md b/README.md index ce56d35..dbce4c7 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,12 @@ 1. [Troubleshooting](5-troubleshooting) 1. [`Write error: disk full;` during `nixos-install`](write-error-disk-full-during-nixos-install) 1. [Impurities](6-impurities) -1. [References](7-references) + 1. [Currently known impurities](61-currently-known-impurities) + 1. [Notes](62-notes) +1. [Resources](7-resources) +1. [Credits & Special thanks](8-credits-special-thanks) + 1. [Major help](81-major-help) + 1. [Additional help](82-additional-help) ## 1. About ❄️ @@ -136,9 +141,23 @@ mount -o remount,size=15G /tmp ## 6. Impurities 💩 -- Currently **none**! 🚀🚀 +I heavily dislike using the `--impure` flag, which is unfortunately required +in certain use cases, and I go really out of my way to patch stuff and +avoid using it. -## 7. References 📚 +### 6.1 Currently known impurities + +- **none**! 🚀🚀 + +### 6.2 Notes + +- [shadow-nix](https://github.com/NicolasGuilloux/shadow-nix) and all its + forks rely on impure imports of hashes, so I am maintaining my own fork + [tsandrini/shadow-nix](https://github.com/tsandrini/shadow-nix) +- I was previously using [devenv](https://devenv.sh/), however, it still doesn't + work really well in a pure mode, so switched to a simple devshell instead. + +## 7. Resources 📚 The whole nix ecosystem is in its foundations a revolutionary piece of software and once you get the hang of it you feel like you’ve really @@ -164,3 +183,33 @@ manual.org?) - [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) - [This is where flake-parts finally clicked for me, huge thanks to viperml~~](https://github.com/viperML/dotfiles) - [dc-tec/nixvim awesome nixvim config that got me started](https://github.com/dc-tec/nixvim/) + +## 8. Credits & Special thanks + +To reiterate the previous [Resources](7-resources) section, here are also some +explicit shoutouts & thanks to the people from whom I have at some point in time +taken some piece of code or have been inspired from. Huge thanks ❤️ + +### 8.1 Major help + +These are people that are engrained in the nix community and whose work I/we +use on a daily basis. I hope they will happily continue to be a part of the +nix community and I thank them for all of their contributions. + +[edolstra](https://github.com/edolstra) +-- [grahamc](https://github.com/grahamc) +-- [domenkozar](https://github.com/domenkozar) +-- [Mic92](https://github.com/Mic92) +-- [hlissner](https://github.com/hlissner) +-- [viperML](https://github.com/viperML) +-- [roberth](https://github.com/roberth) +-- [fufexan](https://github.com/fufexan) +-- [NobbZ](https://github.com/NobbZ) + +### 8.2 Additional help + +Additional help with certain specific areas, inspiration or code snippets. + +[balsoft](https://github.com/balsoft) +-- [dc-tec](https://github.com/dc-tec) +-- [notusknot](https://github.com/notusknot/) diff --git a/flake-parts/hosts/jetbundle/default.nix b/flake-parts/hosts/jetbundle/default.nix index 92ae143..54d8e1b 100644 --- a/flake-parts/hosts/jetbundle/default.nix +++ b/flake-parts/hosts/jetbundle/default.nix @@ -138,7 +138,13 @@ # NOTE for wireguard networking.wireguard.enable = true; networking.firewall = { - allowedUDPPorts = [ 51820 ]; + allowedUDPPorts = [ + 51820 + 4321 + ]; + allowedTCPPorts = [ + 4321 + ]; }; # If you intend to route all your traffic through the wireguard tunnel, the diff --git a/flake-parts/modules/nixvim/default.nix b/flake-parts/modules/nixvim/default.nix index f9c74e4..8afb8d1 100644 --- a/flake-parts/modules/nixvim/default.nix +++ b/flake-parts/modules/nixvim/default.nix @@ -53,11 +53,15 @@ in }; plugins_editor_bufferline = importApply ./plugins/editor/bufferline.nix { inherit localFlake; }; + plugins_editor_spectre = importApply ./plugins/editor/spectre.nix { inherit localFlake; }; plugins_editor_copilot-lua = importApply ./plugins/editor/copilot-lua.nix { inherit localFlake; }; plugins_editor_neo-tree = importApply ./plugins/editor/neo-tree.nix { inherit localFlake; }; plugins_editor_noice = importApply ./plugins/editor/noice.nix { inherit localFlake; }; plugins_editor_treesitter = importApply ./plugins/editor/treesitter.nix { inherit localFlake; }; plugins_editor_undotree = importApply ./plugins/editor/undotree.nix { inherit localFlake; }; + plugins_editor_render-markdown = importApply ./plugins/editor/render-markdown.nix { + inherit localFlake; + }; plugins_cmp_cmp = importApply ./plugins/cmp/cmp.nix { inherit localFlake; }; plugins_cmp_lspkind = importApply ./plugins/cmp/lspkind.nix { inherit localFlake; }; @@ -68,5 +72,6 @@ in plugins_lsp_lsp = importApply ./plugins/lsp/lsp.nix { inherit localFlake; }; plugins_lsp_lspsaga = importApply ./plugins/lsp/lspsaga.nix { inherit localFlake; }; plugins_lsp_trouble = importApply ./plugins/lsp/trouble.nix { inherit localFlake; }; + plugins_lsp_otter = importApply ./plugins/lsp/otter.nix { inherit localFlake; }; }; } diff --git a/flake-parts/modules/nixvim/neovide.nix b/flake-parts/modules/nixvim/neovide.nix index b1bf040..4d152a1 100644 --- a/flake-parts/modules/nixvim/neovide.nix +++ b/flake-parts/modules/nixvim/neovide.nix @@ -47,15 +47,15 @@ in end map("n", "", function() - neovideScale(0.1) + neovideScale(0.05) end) map("n", "", function() - neovideScale(-0.1) + neovideScale(-0.05) end) vim.g.neovide_transparency = 0.92 - neovideScale(-0.3) + neovideScale(-0.35) end ''; } diff --git a/flake-parts/modules/nixvim/plugins/cmp/cmp.nix b/flake-parts/modules/nixvim/plugins/cmp/cmp.nix index 50b94c3..53e738c 100644 --- a/flake-parts/modules/nixvim/plugins/cmp/cmp.nix +++ b/flake-parts/modules/nixvim/plugins/cmp/cmp.nix @@ -21,11 +21,17 @@ }: let inherit (lib) mkIf mkMerge mkEnableOption; - inherit (localFlake.lib.modules) mkOverrideAtNixvimModuleLevel; + inherit (localFlake.lib.modules) + mkOverrideAtNixvimModuleLevel + mkOverrideAtNixvimProfileLevel + isModuleLoadedAndEnabled + ; cfg = config.tensorfiles.nixvim.plugins.cmp.cmp; _ = mkOverrideAtNixvimModuleLevel; + copilot-lua-check = isModuleLoadedAndEnabled config "tensorfiles.nixvim.plugins.editor.copilot-lua"; + get_bufnrs.__raw = '' function() local buf_size_limit = 1024 * 1024 -- 1MB size limit @@ -53,6 +59,16 @@ in // { default = true; }; + + copilot-cmp = { + enable = + mkEnableOption '' + Enable the copilot-cmp integration. + '' + // { + default = true; + }; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -106,6 +122,7 @@ in { name = "nvim_lsp"; priority = 1100; + # group_index = 2; option = { inherit get_bufnrs; }; @@ -113,6 +130,7 @@ in { name = "nvim_lsp_signature_help"; priority = 1000; + # group_index = 2; option = { inherit get_bufnrs; }; @@ -120,6 +138,7 @@ in { name = "nvim_lsp_document_symbol"; priority = 1000; + # group_index = 2; option = { inherit get_bufnrs; }; @@ -181,6 +200,26 @@ in }; } # |----------------------------------------------------------------------| # + (mkIf (cfg.copilot-cmp.enable && copilot-lua-check) { + plugins.copilot-lua = { + suggestion.enabled = mkOverrideAtNixvimProfileLevel false; + panel.enabled = mkOverrideAtNixvimProfileLevel false; + }; + + plugins.cmp.settings = { + sources = [ + { + name = "copilot"; + priority = 1200; + # group_index = 2; + option = { + inherit get_bufnrs; + }; + } + ]; + }; + }) + # |----------------------------------------------------------------------| # ]); meta.maintainers = with localFlake.lib.maintainers; [ tsandrini ]; diff --git a/flake-parts/modules/nixvim/plugins/editor/copilot-lua.nix b/flake-parts/modules/nixvim/plugins/editor/copilot-lua.nix index 3174886..3766ae7 100644 --- a/flake-parts/modules/nixvim/plugins/editor/copilot-lua.nix +++ b/flake-parts/modules/nixvim/plugins/editor/copilot-lua.nix @@ -41,8 +41,15 @@ in { plugins.copilot-lua = { enable = _ true; - suggestion.autoTrigger = _ true; - copilotNodeCommand = _ "node"; + # package = _ patched-copilot-lua; + suggestion = { + enabled = _ true; + autoTrigger = _ true; + }; + # filetypes = { + # "*" = true; + # }; + # copilotNodeCommand = _ "node"; }; } # |----------------------------------------------------------------------| # diff --git a/flake-parts/modules/nixvim/plugins/editor/render-markdown.nix b/flake-parts/modules/nixvim/plugins/editor/render-markdown.nix new file mode 100644 index 0000000..96bdd43 --- /dev/null +++ b/flake-parts/modules/nixvim/plugins/editor/render-markdown.nix @@ -0,0 +1,56 @@ +# --- flake-parts/modules/nixvim/plugins/editor/render-markdown.nix +# +# Author: tsandrini +# URL: https://github.com/tsandrini/tensorfiles +# License: MIT +# +# 888 .d888 d8b 888 +# 888 d88P" Y8P 888 +# 888 888 888 +# 888888 .d88b. 88888b. .d8888b .d88b. 888d888 888888 888 888 .d88b. .d8888b +# 888 d8P Y8b 888 "88b 88K d88""88b 888P" 888 888 888 d8P Y8b 88K +# 888 88888888 888 888 "Y8888b. 888 888 888 888 888 888 88888888 "Y8888b. +# Y88b. Y8b. 888 888 X88 Y88..88P 888 888 888 888 Y8b. X88 +# "Y888 "Y8888 888 888 88888P' "Y88P" 888 888 888 888 "Y8888 88888P' +{ localFlake }: +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) + mkIf + mkMerge + mkEnableOption + ; + # inherit (localFlake.lib.modules) mkOverrideAtNixvimModuleLevel; + + cfg = config.tensorfiles.nixvim.plugins.editor.render-markdown; + # _ = mkOverrideAtNixvimModuleLevel; + +in +{ + options.tensorfiles.nixvim.plugins.editor.render-markdown = { + enable = mkEnableOption '' + TODO + ''; + }; + + config = mkIf cfg.enable (mkMerge [ + # |----------------------------------------------------------------------| # + { + extraPlugins = with pkgs.vimPlugins; [ + render-markdown + ]; + + extraConfigLua = '' + require('render-markdown').setup() + ''; + } + # |----------------------------------------------------------------------| # + ]); + + meta.maintainers = with localFlake.lib.maintainers; [ tsandrini ]; +} diff --git a/flake-parts/modules/nixvim/plugins/editor/spectre.nix b/flake-parts/modules/nixvim/plugins/editor/spectre.nix new file mode 100644 index 0000000..7ce6b95 --- /dev/null +++ b/flake-parts/modules/nixvim/plugins/editor/spectre.nix @@ -0,0 +1,72 @@ +# --- flake-parts/modules/nixvim/plugins/editor/spectre.nix +# +# Author: tsandrini +# URL: https://github.com/tsandrini/tensorfiles +# License: MIT +# +# 888 .d888 d8b 888 +# 888 d88P" Y8P 888 +# 888 888 888 +# 888888 .d88b. 88888b. .d8888b .d88b. 888d888 888888 888 888 .d88b. .d8888b +# 888 d8P Y8b 888 "88b 88K d88""88b 888P" 888 888 888 d8P Y8b 88K +# 888 88888888 888 888 "Y8888b. 888 888 888 888 888 888 88888888 "Y8888b. +# Y88b. Y8b. 888 888 X88 Y88..88P 888 888 888 888 Y8b. X88 +# "Y888 "Y8888 888 888 88888P' "Y88P" 888 888 888 888 "Y8888 88888P' +{ localFlake }: +{ + config, + lib, + ... +}: +let + inherit (lib) + mkIf + mkMerge + mkEnableOption + ; + inherit (localFlake.lib.modules) mkOverrideAtNixvimModuleLevel; + + cfg = config.tensorfiles.nixvim.plugins.editor.spectre; + _ = mkOverrideAtNixvimModuleLevel; +in +{ + options.tensorfiles.nixvim.plugins.editor.spectre = { + enable = mkEnableOption '' + TODO + ''; + + withKeymaps = + mkEnableOption '' + Enable the related included keymaps. + '' + // { + default = true; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + # |----------------------------------------------------------------------| # + { + plugins.spectre = { + enable = _ true; + }; + } + # |----------------------------------------------------------------------| # + (mkIf cfg.withKeymaps { + keymaps = [ + { + mode = "n"; + key = "R"; + action = "Spectre"; + options = { + silent = true; + desc = "Search & Replace"; + }; + } + ]; + }) + # |----------------------------------------------------------------------| # + ]); + + meta.maintainers = with localFlake.lib.maintainers; [ tsandrini ]; +} diff --git a/flake-parts/modules/nixvim/plugins/lsp/conform.nix b/flake-parts/modules/nixvim/plugins/lsp/conform.nix index 5a9a1e2..fc43588 100644 --- a/flake-parts/modules/nixvim/plugins/lsp/conform.nix +++ b/flake-parts/modules/nixvim/plugins/lsp/conform.nix @@ -1,4 +1,4 @@ -# --- flake-parts/modules/nixvim/plugins/lsp.conform.nix +# --- flake-parts/modules/nixvim/plugins/lsp/conform.nix # # Author: tsandrini # URL: https://github.com/tsandrini/tensorfiles @@ -21,8 +21,10 @@ }: let inherit (lib) mkIf mkMerge mkEnableOption; + inherit (localFlake.lib.modules) mkOverrideAtNixvimModuleLevel; cfg = config.tensorfiles.nixvim.plugins.lsp.conform; + _ = mkOverrideAtNixvimModuleLevel; in { options.tensorfiles.nixvim.plugins.lsp.conform = { @@ -43,7 +45,7 @@ in # |----------------------------------------------------------------------| # { plugins.conform-nvim = { - enable = true; + enable = _ true; settings = { # format_on_save = '' # function(bufnr) @@ -77,8 +79,8 @@ in return { lsp_fallback = true } end ''; - notify_on_error = true; - notify_no_formatters = true; + notify_on_error = _ true; + notify_no_formatters = _ true; formatters_by_ft = { html = [ [ @@ -135,40 +137,40 @@ in formatters = { black = { - command = "${lib.getExe pkgs.black}"; + command = _ "${lib.getExe pkgs.black}"; }; isort = { - command = "${lib.getExe pkgs.isort}"; + command = _ "${lib.getExe pkgs.isort}"; }; alejandra = { - command = "${lib.getExe pkgs.alejandra}"; + command = _ "${lib.getExe pkgs.alejandra}"; }; nixfmt-rfc-style = { - command = "${lib.getExe pkgs.nixfmt-rfc-style}"; + command = _ "${lib.getExe pkgs.nixfmt-rfc-style}"; }; jq = { - command = "${lib.getExe pkgs.jq}"; + command = _ "${lib.getExe pkgs.jq}"; }; prettierd = { - command = "${lib.getExe pkgs.prettierd}"; + command = _ "${lib.getExe pkgs.prettierd}"; }; stylua = { - command = "${lib.getExe pkgs.stylua}"; + command = _ "${lib.getExe pkgs.stylua}"; }; shellcheck = { - command = "${lib.getExe pkgs.shellcheck}"; + command = _ "${lib.getExe pkgs.shellcheck}"; }; shfmt = { - command = "${lib.getExe pkgs.shfmt}"; + command = _ "${lib.getExe pkgs.shfmt}"; }; shellharden = { - command = "${lib.getExe pkgs.shellharden}"; + command = _ "${lib.getExe pkgs.shellharden}"; }; bicep = { - command = "${lib.getExe pkgs.bicep}"; + command = _ "${lib.getExe pkgs.bicep}"; }; #yamlfmt = { - # command = "${lib.getExe pkgs.yamlfmt}"; + # command = _ "${lib.getExe pkgs.yamlfmt}"; #}; }; }; diff --git a/flake-parts/modules/nixvim/plugins/lsp/lsp.nix b/flake-parts/modules/nixvim/plugins/lsp/lsp.nix index 2c240f1..df86ca8 100644 --- a/flake-parts/modules/nixvim/plugins/lsp/lsp.nix +++ b/flake-parts/modules/nixvim/plugins/lsp/lsp.nix @@ -64,6 +64,7 @@ in ansiblels.enable = _ true; astro.enable = _ true; bashls.enable = _ true; + hls.enable = _ true; biome.enable = _ true; clangd.enable = _ true; cssls.enable = _ true; diff --git a/flake-parts/modules/nixvim/plugins/lsp/otter.nix b/flake-parts/modules/nixvim/plugins/lsp/otter.nix new file mode 100644 index 0000000..c5413ca --- /dev/null +++ b/flake-parts/modules/nixvim/plugins/lsp/otter.nix @@ -0,0 +1,51 @@ +# --- flake-parts/modules/nixvim/plugins/lsp/otter.nix +# +# Author: tsandrini +# URL: https://github.com/tsandrini/tensorfiles +# License: MIT +# +# 888 .d888 d8b 888 +# 888 d88P" Y8P 888 +# 888 888 888 +# 888888 .d88b. 88888b. .d8888b .d88b. 888d888 888888 888 888 .d88b. .d8888b +# 888 d8P Y8b 888 "88b 88K d88""88b 888P" 888 888 888 d8P Y8b 88K +# 888 88888888 888 888 "Y8888b. 888 888 888 888 888 888 88888888 "Y8888b. +# Y88b. Y8b. 888 888 X88 Y88..88P 888 888 888 888 Y8b. X88 +# "Y888 "Y8888 888 888 88888P' "Y88P" 888 888 888 888 "Y8888 88888P' +{ localFlake }: +{ + config, + lib, + ... +}: +let + inherit (lib) mkIf mkMerge mkEnableOption; + inherit (localFlake.lib.modules) mkOverrideAtNixvimModuleLevel; + + cfg = config.tensorfiles.nixvim.plugins.lsp.otter; + _ = mkOverrideAtNixvimModuleLevel; +in +{ + options.tensorfiles.nixvim.plugins.lsp.otter = { + enable = mkEnableOption '' + TODO + ''; + }; + + config = mkIf cfg.enable (mkMerge [ + # |----------------------------------------------------------------------| # + { + plugins.otter = { + enable = _ true; + settings = { + buffers = { + set_filetype = _ true; + }; + }; + }; + } + # |----------------------------------------------------------------------| # + ]); + + meta.maintainers = with localFlake.lib.maintainers; [ tsandrini ]; +} diff --git a/flake-parts/modules/nixvim/profiles/base.nix b/flake-parts/modules/nixvim/profiles/base.nix index c480e76..0e66ce7 100644 --- a/flake-parts/modules/nixvim/profiles/base.nix +++ b/flake-parts/modules/nixvim/profiles/base.nix @@ -44,7 +44,7 @@ in colorschemes.nightfox.enable = _ true; performance = { - combinePlugins.enable = _ true; + # combinePlugins.enable = _ true; byteCompileLua.enable = _ true; }; } diff --git a/flake-parts/modules/nixvim/profiles/ide.nix b/flake-parts/modules/nixvim/profiles/ide.nix index d5b469f..c16b1bf 100644 --- a/flake-parts/modules/nixvim/profiles/ide.nix +++ b/flake-parts/modules/nixvim/profiles/ide.nix @@ -53,6 +53,7 @@ in lsp.conform.enable = _ true; lsp.fidget.enable = _ true; lsp.trouble.enable = _ true; + lsp.otter.enable = _ true; }; }; diff --git a/flake-parts/modules/nixvim/profiles/minimal.nix b/flake-parts/modules/nixvim/profiles/minimal.nix index 77081c9..42032db 100644 --- a/flake-parts/modules/nixvim/profiles/minimal.nix +++ b/flake-parts/modules/nixvim/profiles/minimal.nix @@ -53,6 +53,8 @@ in editor.treesitter.enable = _ true; editor.undotree.enable = _ true; editor.bufferline.enable = _ true; + editor.spectre.enable = _ true; + editor.render-markdown.enable = _ true; }; }; @@ -60,17 +62,25 @@ in extraPlugins = with pkgs.vimPlugins; [ # nightfox-nvim + # vscode-nvim catppuccin-nvim cyberdream-nvim + doom-one-nvim + dracula-nvim + everforest gruvbox-nvim kanagawa-nvim + melange-nvim modus-themes-nvim neovim-ayu + nord-nvim + one-nvim onedark-nvim + onenord-nvim oxocarbon-nvim + poimandres-nvim rose-pine tokyonight-nvim - # vscode-nvim ]; plugins.mini = {