diff --git a/flake.lock b/flake.lock index 99955e5..a861468 100644 --- a/flake.lock +++ b/flake.lock @@ -52,11 +52,11 @@ ] }, "locked": { - "lastModified": 1764627417, - "narHash": "sha256-D6xc3Rl8Ab6wucJWdvjNsGYGSxNjQHzRc2EZ6eeQ6l4=", + "lastModified": 1766150702, + "narHash": "sha256-P0kM+5o+DKnB6raXgFEk3azw8Wqg5FL6wyl9jD+G5a4=", "owner": "nix-community", "repo": "disko", - "rev": "5a88a6eceb8fd732b983e72b732f6f4b8269bef3", + "rev": "916506443ecd0d0b4a0f4cf9d40a3c22ce39b378", "type": "github" }, "original": { @@ -111,27 +111,27 @@ ] }, "locked": { - "lastModified": 1763992789, - "narHash": "sha256-WHkdBlw6oyxXIra/vQPYLtqY+3G8dUVZM8bEXk0t8x4=", + "lastModified": 1767514898, + "narHash": "sha256-ONYqnKrPzfKEEPChoJ9qPcfvBqW9ZgieDKD7UezWPg4=", "owner": "nix-community", "repo": "home-manager", - "rev": "44831a7eaba4360fb81f2acc5ea6de5fde90aaa3", + "rev": "7a06e8a2f844e128d3b210a000a62716b6040b7f", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-25.05", + "ref": "release-25.11", "repo": "home-manager", "type": "github" } }, "nixos-hardware": { "locked": { - "lastModified": 1764440730, - "narHash": "sha256-ZlJTNLUKQRANlLDomuRWLBCH5792x+6XUJ4YdFRjtO4=", + "lastModified": 1767185284, + "narHash": "sha256-ljDBUDpD1Cg5n3mJI81Hz5qeZAwCGxon4kQW3Ho3+6Q=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "9154f4569b6cdfd3c595851a6ba51bfaa472d9f3", + "rev": "40b1a28dce561bea34858287fbb23052c3ee63fe", "type": "github" }, "original": { @@ -143,26 +143,26 @@ }, "nixpkgs": { "locked": { - "lastModified": 1764560356, - "narHash": "sha256-M5aFEFPppI4UhdOxwdmceJ9bDJC4T6C6CzCK1E2FZyo=", + "lastModified": 1767480499, + "narHash": "sha256-8IQQUorUGiSmFaPnLSo2+T+rjHtiNWc+OAzeHck7N48=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6c8f0cca84510cc79e09ea99a299c9bc17d03cb6", + "rev": "30a3c519afcf3f99e2c6df3b359aec5692054d92", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-25.05", + "ref": "nixos-25.11", "type": "indirect" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1764517877, - "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", + "lastModified": 1767379071, + "narHash": "sha256-EgE0pxsrW9jp9YFMkHL9JMXxcqi/OoumPJYwf+Okucw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c", + "rev": "fb7944c166a3b630f177938e478f0378e64ce108", "type": "github" }, "original": { @@ -220,11 +220,11 @@ ] }, "locked": { - "lastModified": 1762938485, - "narHash": "sha256-AlEObg0syDl+Spi4LsZIBrjw+snSVU4T8MOeuZJUJjM=", + "lastModified": 1767468822, + "narHash": "sha256-MpffQxHxmjVKMiQd0Tg2IM/bSjjdQAM+NDcX6yxj7rE=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "5b4ee75aeefd1e2d5a1cc43cf6ba65eba75e83e4", + "rev": "d56486eb9493ad9c4777c65932618e9c2d0468fc", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2235dde..6191dd4 100644 --- a/flake.nix +++ b/flake.nix @@ -2,10 +2,10 @@ description = "Who needs a working system anyways, me smash state"; inputs = { - nixpkgs.url = "nixpkgs/nixos-25.05"; + nixpkgs.url = "nixpkgs/nixos-25.11"; nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; home-manager = { - url = "github:nix-community/home-manager/release-25.05"; + url = "github:nix-community/home-manager/release-25.11"; inputs.nixpkgs.follows = "nixpkgs"; }; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; diff --git a/home/default.nix b/home/default.nix index 97a984d..f59c1b5 100644 --- a/home/default.nix +++ b/home/default.nix @@ -19,9 +19,9 @@ in home.homeDirectory = "/home/jgero"; home.packages = with pkgs; [ - bitwarden + bitwarden-desktop signal-desktop - firefox-wayland + firefox thunderbird libreoffice gimp diff --git a/home/git.nix b/home/git.nix index d9be630..77abfcc 100644 --- a/home/git.nix +++ b/home/git.nix @@ -1,9 +1,11 @@ { osConfig, ... }: { programs.git = { enable = true; - userName = "Johannes Gerold"; - userEmail = osConfig.jgero.user.email; - extraConfig = { + settings = { + user = { + name = "Johannes Gerold"; + email = osConfig.jgero.user.email; + }; init = { defaultBranch = "main"; }; }; }; diff --git a/modules/sway.nix b/modules/sway.nix index f207e19..8ba5285 100644 --- a/modules/sway.nix +++ b/modules/sway.nix @@ -39,7 +39,7 @@ enable = true; settings = { default_session = { - command = "${pkgs.greetd.greetd}/bin/agreety --cmd sway"; + command = "${pkgs.greetd}/bin/agreety --cmd sway"; }; }; }; diff --git a/pkgs/neovim/lib/mkPack.nix b/pkgs/neovim/lib/mkPack.nix index ff87da2..2b579be 100644 --- a/pkgs/neovim/lib/mkPack.nix +++ b/pkgs/neovim/lib/mkPack.nix @@ -14,6 +14,6 @@ pkgs.stdenv.mkDerivation (rec { installPhase = '' mkdir -p $out/lua/${pname} cp $init $out/lua/${pname}/init.lua - ${if (def ? sources) then "cp $src/* $out/lua/${pname}/" else ""} + ${if (def ? sources) then "cp $src/*.lua $out/lua/${pname}/" else ""} ''; } // (if (def ? sources) then { src = def.sources; } else { })) diff --git a/pkgs/neovim/partials/builtins/options.lua b/pkgs/neovim/partials/builtins/options.lua index 4ecdbc0..14c3f59 100644 --- a/pkgs/neovim/partials/builtins/options.lua +++ b/pkgs/neovim/partials/builtins/options.lua @@ -37,7 +37,7 @@ vim.o.undodir = vim.fn.stdpath("data") .. "/undodir" -- visuals vim.o.termguicolors = true -- is also set automatically by some themes vim.o.signcolumn = "yes:5" -- give plenty of space for signs -vim.o.cmdheight = 0 +vim.o.cmdheight = 4 vim.o.scrolloff = 8 -- don't let cursor get too close to the edge -- performance vim.o.updatetime = 50 diff --git a/pkgs/neovim/partials/default.nix b/pkgs/neovim/partials/default.nix index 7261e66..429f256 100644 --- a/pkgs/neovim/partials/default.nix +++ b/pkgs/neovim/partials/default.nix @@ -53,9 +53,11 @@ map mkPack cmp_luasnip friendly-snippets lsp_lines-nvim + + helm-ls-nvim ]; sources = ./languages; - init = (requireAllModules name sources) + (import ./languages/nvim-lspconfig.lua.nix { inherit pkgs pkgs-unstable; }); + init = (requireAllModules name sources) + (import ./lsp-config { inherit pkgs pkgs-unstable; }); } rec { name = withPrefix "git"; @@ -115,7 +117,9 @@ map mkPack name = withPrefix "ui"; order = 1; plugins = [ plugins.fidget-nvim ]; - init = ''require("fidget").setup({})''; + init = '' + require("fidget").setup({ notification = { override_vim_notify = true } }) + ''; } { name = withPrefix "testing-debugging"; diff --git a/pkgs/neovim/partials/languages/cmp.lua b/pkgs/neovim/partials/languages/cmp.lua index 1bb68ea..3288140 100644 --- a/pkgs/neovim/partials/languages/cmp.lua +++ b/pkgs/neovim/partials/languages/cmp.lua @@ -40,6 +40,10 @@ vim.keymap.set({ "i", "s" }, "", function() ls.jump(1) end, { silent = true, desc = "jump forwards in snippet" }) +vim.keymap.set({ "i", "s" }, "", function() + ls.jump(-1) +end, { silent = true, desc = "jump backwards in snippet" }) + local s = ls.snippet local t = ls.text_node local i = ls.insert_node diff --git a/pkgs/neovim/partials/languages/misc.lua b/pkgs/neovim/partials/languages/misc.lua new file mode 100644 index 0000000..655bd58 --- /dev/null +++ b/pkgs/neovim/partials/languages/misc.lua @@ -0,0 +1 @@ +require("helm-ls").setup() diff --git a/pkgs/neovim/partials/languages/nvim-lspconfig.lua.nix b/pkgs/neovim/partials/languages/nvim-lspconfig.lua.nix deleted file mode 100644 index 00dfa5a..0000000 --- a/pkgs/neovim/partials/languages/nvim-lspconfig.lua.nix +++ /dev/null @@ -1,116 +0,0 @@ -{ pkgs, pkgs-unstable, ... }: '' - local function use_exec_or_fallback(exec, fallback, ...) - local cmd = {} - if vim.fn.executable(exec) == 1 then - table.insert(cmd, exec) - else - table.insert(cmd, fallback) - end - for _, arg in ipairs({...}) do - table.insert(cmd, arg) - end - return cmd - end - local on_attach = function(client, bufnr) - local nmap = function(keys, func, desc) - if desc then - desc = "LSP: " .. desc - end - vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc }) - end - - if client.server_capabilities.documentFormattingProvider then - nmap("lf", vim.lsp.buf.format, "[l]sp do [f]ormatting") - end - - nmap("gd", vim.lsp.buf.definition, "[g]o to [d]efinition") - nmap("rn", vim.lsp.buf.rename, "[r]e[n]ame") - nmap("d", vim.lsp.buf.signature_help, "show signature help [d]ocumentation") - nmap("df", vim.diagnostic.open_float, "show [d]iagnostics [f]loat") - nmap("ca", vim.lsp.buf.code_action, "[c]ode [a]ctions") - nmap("H", vim.lsp.buf.hover, "[H]over") - end - local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) - local lspc = require("lspconfig") - lspc.lua_ls.setup({ - capabilities = capabilities, - on_attach = on_attach, - settings = { - Lua = { - workspace = { - checkThirdParty = false, - library = { - vim.env.VIMRUNTIME - }, - }, - telemetry = { enable = false }, - }, - }, - cmd = use_exec_or_fallback("lua-language-server", "${pkgs.sumneko-lua-language-server}/bin/lua-language-server"), - }) - lspc.nil_ls.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("nil", "${pkgs.nil}/bin/nil"), - }) - lspc.bashls.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("bash-language-server", "${pkgs.nodePackages.bash-language-server}/bin/bash-language-server", "start"), - }) - lspc.clangd.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("clangd", "${pkgs.clang-tools}/bin/clangd"), - }) - lspc.html.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("vscode-html-language-server", "${pkgs.vscode-langservers-extracted}/bin/vscode-html-language-server", "--stdio"), - }) - lspc.cssls.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("vscode-css-language-server", "${pkgs.vscode-langservers-extracted}/bin/vscode-css-language-server", "--stdio"), - }) - lspc.jsonls.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("vscode-json-language-server", "${pkgs.vscode-langservers-extracted}/bin/vscode-json-language-server", "--stdio"), - }) - lspc.ts_ls.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("typescript-language-server", "${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server", "--stdio"), - - }) - lspc.rust_analyzer.setup({ - settings = { - ['rust-analyzer'] = { - cargo = { - features = "all" - } - } - }, - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("rust-analyzer", "${pkgs.rust-analyzer}/bin/rust-analyzer"), - }) - lspc.gopls.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("gopls", "${pkgs.gopls}/bin/gopls"), - }) - lspc.templ.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = use_exec_or_fallback("templ", "${pkgs.templ}/bin/templ", "lsp"), - }) - lspc.golangci_lint_ls.setup({ - capabilities = capabilities, - cmd = use_exec_or_fallback("golangci-lint-langserver", "${pkgs-unstable.golangci-lint-langserver}/bin/golangci-lint-langserver"), - init_options = { - command = { "${pkgs-unstable.golangci-lint}/bin/golangci-lint", "run", "--output.json.path", "stdout", "--show-stats=false", "--issues-exit-code=1" }, - }, - }) -'' diff --git a/pkgs/neovim/partials/lsp-config/default.nix b/pkgs/neovim/partials/lsp-config/default.nix new file mode 100644 index 0000000..66e0434 --- /dev/null +++ b/pkgs/neovim/partials/lsp-config/default.nix @@ -0,0 +1,70 @@ +{ pkgs, pkgs-unstable, ... }: +let + genLspConfig = name: cmd: extraConfig: '' + vim.lsp.config("${name}", { + cmd = use_exec_or_fallback("${builtins.baseNameOf (builtins.elemAt cmd 0)}", ${ + builtins.concatStringsSep ", " (map (v: ''"${v}"'') cmd) + }), + ${extraConfig} + }) + vim.lsp.enable("${name}") + ''; +in +( + (builtins.readFile ./lsp-config.lua) + + (builtins.concatStringsSep "\n" ([ + (genLspConfig "nil_ls" [ "${pkgs.nil}/bin/nil" ] "") + (genLspConfig "lua_ls" [ "${pkgs.lua-language-server}/bin/lua-language-server" ] '' + settings = { + Lua = { + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME + }, + }, + telemetry = { enable = false }, + }, + }, + '') + (genLspConfig "bashls" [ "${pkgs.bash-language-server}/bin/bash-language-server" "start" ] "") + (genLspConfig "clangd" [ "${pkgs.clang-tools}/bin/clangd" ] "") + (genLspConfig "html" [ + "${pkgs.vscode-langservers-extracted}/bin/vscode-html-language-server" + "--stdio" + ] "") + (genLspConfig "cssls" [ + "${pkgs.vscode-langservers-extracted}/bin/vscode-css-language-server" + "--stdio" + ] "") + (genLspConfig "jsonls" [ + "${pkgs.vscode-langservers-extracted}/bin/vscode-json-language-server" + "--stdio" + ] "") + (genLspConfig "ts_ls" [ + "${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server" + "--stdio" + ] "") + (genLspConfig "rust_analyzer" [ "${pkgs.rust-analyzer}/bin/rust-analyzer" ] '' + settings = { + ['rust-analyzer'] = { + cargo = { + features = "all" + } + } + }, + '') + (genLspConfig "gopls" [ "${pkgs.gopls}/bin/gopls" ] "") + (genLspConfig "templ" [ "${pkgs.templ}/bin/templ" "lsp" ] "") + (genLspConfig "golangci_lint_ls" [ + "${pkgs-unstable.golangci-lint-langserver}/bin/golangci-lint-langserver" + ] "") + (genLspConfig "postgres_lsp" [ + "${pkgs-unstable.postgres-language-server}/bin/postgres-language-server" + "lsp-proxy" + ] "") + (genLspConfig "helm_ls" [ "${pkgs.helm-ls}/bin/helm_ls" "serve" ] "") + (genLspConfig "terraformls" [ "${pkgs.terraform-ls}/bin/terraform-ls" "serve" ] "") + (genLspConfig "yamlls" [ "${pkgs.yaml-language-server}/bin/yaml-language-server" "--stdio" ] "") + ])) +) diff --git a/pkgs/neovim/partials/lsp-config/lsp-config.lua b/pkgs/neovim/partials/lsp-config/lsp-config.lua new file mode 100644 index 0000000..d737c6c --- /dev/null +++ b/pkgs/neovim/partials/lsp-config/lsp-config.lua @@ -0,0 +1,52 @@ +local function use_exec_or_fallback(exec, fallback, ...) + local cmd = {} + if vim.fn.executable(exec) == 1 then + table.insert(cmd, exec) + else + table.insert(cmd, fallback) + end + for _, arg in ipairs({ ... }) do + table.insert(cmd, arg) + end + return cmd +end + +vim.opt.completeopt = { "menuone", "noselect", "popup" } + +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("my.lsp", {}), + callback = function(args) + local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) + + local function nmap_for_method(method, keys, func, desc) + if not client:supports_method(method) then + return + end + if desc then + desc = "LSP: " .. desc + end + vim.keymap.set("n", keys, func, { buffer = args.buf, desc = desc }) + end + nmap_for_method("textDocument/definition", "gd", vim.lsp.buf.definition, "[g]o to [d]efinition") + nmap_for_method("textDocument/rename", "rn", vim.lsp.buf.rename, "[r]e[n]ame") + nmap_for_method( + "signature_help", + "d", + vim.lsp.buf.signature_help, + "show signature help [d]ocumentation" + ) + nmap_for_method( + "textDocument/diagnostic", + "df", + vim.diagnostic.open_float, + "show [d]iagnostics [f]loat" + ) + nmap_for_method("textDocument/codeAction", "ca", vim.lsp.buf.code_action, "[c]ode [a]ctions") + nmap_for_method("textDocument/hover", "H", vim.lsp.buf.hover, "[H]over") + nmap_for_method("textDocument/formatting", "lf", vim.lsp.buf.format, "[l]sp do [f]ormatting") + end, +}) +vim.lsp.config("*", { + capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()), + root_markers = { ".git" }, +}) diff --git a/pkgs/neovim/partials/tabset.nix b/pkgs/neovim/partials/tabset.nix index ccec823..e1d9135 100644 --- a/pkgs/neovim/partials/tabset.nix +++ b/pkgs/neovim/partials/tabset.nix @@ -19,7 +19,7 @@ }, languages = { { - filetypes = { "go", "lua" }, + filetypes = { "go", "lua", "make" }, config = { tabwidth = 4, expandtab = false,