From c03c84015473e9661c10bdaab9147ce34f5969c4 Mon Sep 17 00:00:00 2001 From: irl Date: Sat, 7 Jun 2025 14:32:45 +0100 Subject: [PATCH 1/2] fix: use new per-system target for hms alias --- home/irl.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/home/irl.nix b/home/irl.nix index 0b301ea..0ec4a87 100644 --- a/home/irl.nix +++ b/home/irl.nix @@ -24,7 +24,9 @@ in ]; home.shellAliases = { hms = - "home-manager switch --flake ~/.config/nix-configs#irl" + (if cfg.gui-packages then "-gui" else ""); + "home-manager switch --flake ~/.config/nix-configs#irl" + + (if cfg.gui-packages then "-gui" else "") + + "-${pkgs.system}"; }; programs.bash = { enable = true; From 3b810aebc06397534153deb04bd49a1ddfc32d5a Mon Sep 17 00:00:00 2001 From: irl Date: Sat, 7 Jun 2025 15:44:01 +0100 Subject: [PATCH 2/2] feat: adding rust lsp to neovim --- home/irl.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/home/irl.nix b/home/irl.nix index 0ec4a87..dde5137 100644 --- a/home/irl.nix +++ b/home/irl.nix @@ -19,6 +19,7 @@ in home.packages = with pkgs; [ fish neofetch + rust-analyzer starship tree ]; @@ -93,8 +94,47 @@ in vimdiffAlias = true; plugins = with pkgs.vimPlugins; [ bufferline-nvim + nvim-lspconfig nvim-treesitter.withAllGrammars ]; + extraLuaConfig = '' + vim.lsp.config('rust_analyzer', { + settings = { + ['rust-analyzer'] = {}, + }, + }) + 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)) + if client:supports_method('textDocument/implementation') then + -- Create a keymap for vim.lsp.buf.implementation ... + end + + -- Enable auto-completion. Note: Use CTRL-Y to select an item. |complete_CTRL-Y| + if client:supports_method('textDocument/completion') then + -- Optional: trigger autocompletion on EVERY keypress. May be slow! + -- local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end + -- client.server_capabilities.completionProvider.triggerCharacters = chars + + vim.lsp.completion.enable(true, client.id, args.buf, {autotrigger = true}) + end + + -- Auto-format ("lint") on save. + -- Usually not needed if server supports "textDocument/willSaveWaitUntil". + if not client:supports_method('textDocument/willSaveWaitUntil') + and client:supports_method('textDocument/formatting') then + vim.api.nvim_create_autocmd('BufWritePre', { + group = vim.api.nvim_create_augroup('my.lsp', {clear=false}), + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 }) + end, + }) + end + end, + }) + ''; }; programs.starship = { enable = true;