diff --git a/flake.lock b/flake.lock index f75a33e..eb20aaa 100644 --- a/flake.lock +++ b/flake.lock @@ -210,21 +210,6 @@ } }, "flake-utils_5": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_6": { "locked": { "lastModified": 1644229661, "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", @@ -434,27 +419,6 @@ "type": "github" } }, - "neovim": { - "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_6" - }, - "locked": { - "dir": "contrib", - "lastModified": 1676603980, - "narHash": "sha256-EWHGiO/1dulYfzdUnxXqW6nu79T+soBC/YS0tZPtlQ0=", - "owner": "neovim", - "repo": "neovim", - "rev": "371a74e4e1685f21e83c70eb8f0bd05c2ce24e49", - "type": "github" - }, - "original": { - "dir": "contrib", - "owner": "neovim", - "repo": "neovim", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1673540789, @@ -568,22 +532,6 @@ } }, "nixpkgs_6": { - "locked": { - "lastModified": 1671983799, - "narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_7": { "locked": { "lastModified": 1675940568, "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", @@ -599,7 +547,7 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_7": { "locked": { "lastModified": 1671271357, "narHash": "sha256-xRJdLbWK4v2SewmSStYrcLa0YGJpleufl44A19XSW8k=", @@ -671,9 +619,9 @@ "pre-commit-hooks_3": { "inputs": { "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_4", "gitignore": "gitignore_2", - "nixpkgs": "nixpkgs_8", + "nixpkgs": "nixpkgs_7", "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { @@ -703,8 +651,7 @@ "hyprland": "hyprland", "hyprpaper": "hyprpaper", "master": "master", - "neovim": "neovim", - "nixpkgs": "nixpkgs_7", + "nixpkgs": "nixpkgs_6", "pre-commit-hooks": "pre-commit-hooks_3", "stable": "stable", "utils": "utils_2" @@ -743,7 +690,7 @@ }, "utils_2": { "inputs": { - "flake-utils": "flake-utils_6" + "flake-utils": "flake-utils_5" }, "locked": { "lastModified": 1657226504, diff --git a/flake.nix b/flake.nix index 8b09ac9..945aaf5 100644 --- a/flake.nix +++ b/flake.nix @@ -48,8 +48,6 @@ emacs.url = "git+ssh://git@gitea.moritzboeh.me/moritz/emacs.git?ref=main"; - neovim.url = "github:neovim/neovim?dir=contrib"; - # Hyprland hyprland.url = "github:hyprwm/Hyprland"; hyprpaper.url = "github:hyprwm/hyprpaper"; @@ -72,10 +70,12 @@ overlay = import ./overlays { inherit inputs; }; channels.nixpkgs.overlaysBuilder = channels: [ + inputs.agenix.overlays.default inputs.emacs.overlays.default inputs.howdy.overlays.default inputs.hypr-contrib.overlays.default inputs.hyprland.overlays.default + inputs.hyprpaper.overlays.default inputs.utils.overlay self.overlay ]; diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 5549f2b..1c00cf5 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -20,33 +20,22 @@ in config = mkIf cfg.enable { home-manager.users.moritz.programs.neovim = { enable = true; - package = pkgs.neovim-nightly; vimAlias = true; vimdiffAlias = true; withNodeJs = true; withPython3 = true; extraLuaConfig = builtins.readFile ./init.lua; - extraPackages = with pkgs; [ - sumneko-lua-language-server - nil - ]; plugins = with pkgs.vimPlugins; [ catppuccin-nvim - cmp-nvim-lsp dashboard-nvim neogit noice-nvim nui-nvim # for noice-nvim - nvim-cmp - nvim-lspconfig nvim-treesitter.withAllGrammars nvim-web-devicons # for dashboard-nvim plenary-nvim # for telescope, neogit telescope-nvim which-key-nvim - cmp_luasnip - luasnip - lsp_lines-nvim ]; }; }; diff --git a/modules/programs/nvim/init.lua b/modules/programs/nvim/init.lua index 18cd345..1cb5fce 100644 --- a/modules/programs/nvim/init.lua +++ b/modules/programs/nvim/init.lua @@ -33,13 +33,11 @@ vim.opt.updatetime = 300 vim.opt_local.spell = true vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling +-- plugins require("catppuccin").setup({ - compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store - integrations = { - which_key = true, - }, + flavour = "macchiato", }) -vim.cmd.colorscheme("catppuccin-macchiato") +vim.cmd.colorscheme("catppuccin") vim.o.timeout = true vim.o.timeoutlen = 300 @@ -65,20 +63,20 @@ require("noice").setup({ }) wk.register({ - f = { - name = "find", - f = { "Telescope find_files", "find file" }, - g = { "Telescope live_grep", "live grep" }, - b = { "Telescope buffers", "find buffer" }, - }, + f = { + name="find", + f = { "Telescope find_files", "find file" }, + g = { "Telescope live_grep", "live grep" }, + b = { "Telescope buffers", "find buffer" }, + }, }, { prefix = "" }) require("neogit").setup({ - disable_commit_confirmation = true, + disable_commit_confirmation = true, }) wk.register({ - g = { "Neogit", "git" }, -}, { prefix = "" }) + g = { "Neogit", "git" } +}, { prefix = ""}) require("nvim-treesitter.configs").setup({ sync_install = false, @@ -88,127 +86,3 @@ require("nvim-treesitter.configs").setup({ additional_vim_regex_highlighting = true, }, }) - -local cmp = require("cmp") -local luasnip = require("luasnip") -cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }), - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - }, -}) - --- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. -local capabilities = require("cmp_nvim_lsp").default_capabilities() - -local lspconfig = require("lspconfig") -local on_attach_def = function(_, bufnr) - wk.register({ - K = { vim.lsp.buf.hover, "show info" }, - ["l"] = { - name = "lsp", - d = { vim.diagnostic.open_float, "open diagnostic window" }, - n = { vim.diagnostic.goto_next, "next error" }, - p = { vim.diagnostic.goto_prev, "prev error" }, - c = { vim.lsp.buf.code_action, "code action" }, - r = { vim.lsp.buf.rename, "rename" }, - f = { - function() - vim.lsp.buf.format({ async = true }) - end, - "format", - }, - }, - g = { - name = "goto", - r = { vim.lsp.buf.references, "references" }, - d = { vim.lsp.buf.definition, "definition" }, - D = { vim.lsp.buf.declaration, "declaration" }, - i = { vim.lsp.buf.implementation, "implementation" }, - t = { vim.lsp.buf.type_definition, "type defininition" }, - }, - }, { noremap = true, silent = true, buffer = bufnr }) -end - -local servers = { "nil_ls", "pylsp" } -for _, lsp in ipairs(servers) do - lspconfig[lsp].setup({ - on_attach = on_attach_def, - capabilities = capabilities, - flags = { - debounce_text_changes = 100, - }, - }) -end - -lspconfig.sumneko_lua.setup({ - on_attach = on_attach_def, - capabilities = capabilities, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - checkThirdParty = false, - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, -}) - -local lsp_lines = require("lsp_lines") -lsp_lines.setup() --- Disable virtual_text since it's redundant due to lsp_lines. -vim.diagnostic.config({ - virtual_text = false, -}) -wk.register({ - t = { - name = "toggle", - l = { lsp_lines.toggle, "lsp lines" }, - }, - { prefix = "" }, -}) diff --git a/overlays/default.nix b/overlays/default.nix index 9a7098b..071a899 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,8 +1,4 @@ { inputs }: final: prev: { - agenix = inputs.agenix.packages.${prev.system}.default; - hyprpaper = inputs.hyprpaper.packages.${prev.system}.default; - neovim-nightly = inputs.neovim.packages.${prev.system}.default; - logseq-wayland = prev.symlinkJoin { name = "logseq-wayland"; paths = [ prev.logseq ];