diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index 2248532..9bf8020 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -139,6 +139,7 @@ in "networkmanager" "wheel" "docker" + "audio" ]; shell = pkgs.fish; }; @@ -176,7 +177,7 @@ in services.lact.enable = true; services.rsync.enable = true; programs.kdeconnect.enable = true; - # programs.neovim.enable = true; + programs.neovim.enable = true; programs.tmux.enable = true; programs.bat.enable = true; programs.git = { @@ -245,10 +246,19 @@ in services.pipewire = { enable = true; alsa.enable = true; + alsa.support32Bit = true; pulse.enable = true; jack.enable = true; }; + services.pipewire.extraConfig.pipewire."92-clock-quantum" = { + "context.properties" = { + "default.clock.quantum" = 2048; + "default.clock.min-quantum" = 256; + "default.clock.max-quantum" = 4096; + }; + }; + security.pam.loginLimits = [ { domain = "@users"; diff --git a/modules/programs/neovim/keymaps.nix b/modules/programs/neovim/keymaps.nix index 388fee0..af16245 100644 --- a/modules/programs/neovim/keymaps.nix +++ b/modules/programs/neovim/keymaps.nix @@ -9,6 +9,10 @@ action = "lua Snacks.explorer.open()"; key = "e"; } + { + action = "lua Snacks.bufdelete()"; + key = ""; + } { mode = [ "n" @@ -18,6 +22,14 @@ action = ''lua require("flash").jump()''; key = "s"; } + { + action = "BufferLineCycleNext"; + key = ""; + } + { + action = "BufferLineCyclePrev"; + key = ""; + } ]; }; } diff --git a/modules/programs/neovim/lsp.nix b/modules/programs/neovim/lsp.nix new file mode 100644 index 0000000..1187386 --- /dev/null +++ b/modules/programs/neovim/lsp.nix @@ -0,0 +1,28 @@ +{ + programs.nixvim.lsp = { + servers = { + lua_ls.enable = true; + nixd = { + enable = true; + config = { + nixd = { + nixpkgs = { + expr = ''import (builtins.getFlake "/home/user/nix-config").inputs.nixpkgs { }''; + }; + formatting = { + command = "nixfmt"; + }; + options = { + nixos = { + expr = ''(builtins.getFlake "/home/user/nix-config").nixosConfigurations.desktop.options''; + }; + home_manager = { + expr = ''(builtins.getFlake "/home/user/nix-config").nixosConfigurations.desktop.options.home-manager.users.type.getSubOptions []''; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/modules/programs/neovim/neovim.nix b/modules/programs/neovim/neovim.nix index 5173d2d..7ec6e7c 100644 --- a/modules/programs/neovim/neovim.nix +++ b/modules/programs/neovim/neovim.nix @@ -1,64 +1,167 @@ -{ nixvim, pkgs, ... }: +{ + nixvim, + pkgs, + ... +}: { imports = [ nixvim.nixosModules.nixvim + ./plugins ./keymaps.nix + ./lsp.nix ]; programs.nixvim = { - enable = true; + enable = false; defaultEditor = true; clipboard.register = "unnamedplus"; - colorschemes.tokyonight = { + opts = { + number = true; + relativenumber = true; + expandtab = true; + shiftwidth = 2; + smartindent = true; + tabstop = 2; + softtabstop = 2; + + fillchars.eob = " "; + ignorecase = true; + smartcase = true; + mouse = "a"; + }; + + # colorschemes.nightfox = { + # enable = true; + # settings = { + # # style = "moon"; + # flavor = "carbonfox"; + # options.transparent = true; + # styles = { + # sidebars = "transparent"; + # floats = "transparent"; + # }; + # }; + # }; + + colorschemes.base16 = { enable = true; + settings = { - transparent = true; + base00 = "11121d"; + base01 = "282934"; + base02 = "353747"; # slightly lighter than base01 (or reuse 282934) + base03 = "565b6b"; # comment color; you'll probably want to tweak this + base04 = "abb2bf"; + base05 = "abb2bf"; + base06 = "b2b9c6"; + base07 = "ffffff"; + + base08 = "ee6d85"; + base09 = "f3627a"; + base0A = "dfae67"; + base0B = "95c561"; + base0C = "a485dd"; # no cyan in your palette, so purple works + base0D = "7199ee"; + base0E = "a485dd"; + base0F = "f3627a"; }; }; extraPlugins = [ pkgs.vimPlugins.boole-nvim ]; + extraConfigLua = '' + require('boole').setup({ + mappings = { + -- increment = '', + decrement = '' + }, + allow_caps_additions = { + {'enable', 'disable'}, + {'true', 'false'} + } + }) + ''; plugins = { lualine.enable = true; - bufferline.enable = true; + bufferline = { + enable = true; + settings = { + options = { + show_buffer_close_icons = false; + show_close_icon = false; + }; + }; + }; yazi.enable = true; cord = { enable = true; settings.display.theme = "atom"; }; neoscroll.enable = true; - snacks = { + telescope = { enable = true; - settings = { - bigfile.enabled = true; - dashboard.enabled = true; - explorer = { - enabled = true; - auto_close = true; - }; - indent.enabled = false; - input.enabled = true; - picker.enabled = true; - notifier.enabled = true; - quickfile.enabled = true; - statuscolumn.enabled = true; - words.enabled = true; - }; + enabledExtensions = [ "persisted" ]; }; - telescope.enable = true; which-key.enable = true; flash.enable = true; lsp.enable = true; - }; - - lsp = { - servers = { - lua_ls.enable = true; - nixd.enable = true; + fugitive.enable = true; + treesitter = { + enable = true; + highlight.enable = true; + indent.enable = true; + settings.ensure_installed = "all"; + }; + gitsigns.enable = true; + nvim-autopairs = { + enable = true; + }; + cmp = { + autoEnableSources = true; + settings.sources = [ + { name = "nvim_lsp"; } + { name = "path"; } + { name = "buffer"; } + ]; + }; + persisted.enable = true; + render-markdown.enable = true; + transparent = { + enable = true; + autoLoad = true; + settings = { + groups = [ + "Normal" + "NormalNC" + "Comment" + "Constant" + "Special" + "Identifier" + "Statement" + "PreProc" + "Type" + "Underlined" + "Todo" + "String" + "Function" + "Conditional" + "Repeat" + "Operator" + "Structure" + "LineNr" + "NonText" + "SignColumn" + "CursorLine" + "CursorLineNr" + "StatusLine" + "StatusLineNC" + "EndOfBuffer" + ]; + + }; }; - inlayHints.enable = true; }; }; diff --git a/modules/programs/neovim/plugins/conform.nix b/modules/programs/neovim/plugins/conform.nix new file mode 100644 index 0000000..3eede39 --- /dev/null +++ b/modules/programs/neovim/plugins/conform.nix @@ -0,0 +1,35 @@ +{ pkgs, ... }: +{ + programs.nixvim.extraPackages = with pkgs; [ + stylua + nixfmt + ]; + + programs.nixvim.plugins = { + conform-nvim = { + enable = true; + settings = { + format_on_save = '' + function(bufnr) + -- Disable "format_on_save lsp_fallback" for lanuages that don't + -- have a well standardized coding style. You can add additional + -- lanuages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true } + if disable_filetypes[vim.bo[bufnr].filetype] then + return nil + else + return { + timeout_ms = 500, + lsp_format = "fallback", + } + end + end + ''; + formatters_by_ft = { + lua = [ "stylua" ]; + nix = [ "nixfmt" ]; + }; + }; + }; + }; +} diff --git a/modules/programs/neovim/plugins/default.nix b/modules/programs/neovim/plugins/default.nix new file mode 100644 index 0000000..9223bd3 --- /dev/null +++ b/modules/programs/neovim/plugins/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./snacks.nix + ./conform.nix + ]; +} diff --git a/modules/programs/neovim/plugins/snacks.nix b/modules/programs/neovim/plugins/snacks.nix new file mode 100644 index 0000000..3628062 --- /dev/null +++ b/modules/programs/neovim/plugins/snacks.nix @@ -0,0 +1,81 @@ +{ + programs.nixvim.plugins = { + snacks = { + enable = true; + settings = { + bigfile.enabled = true; + dashboard = { + enabled = true; + preset = { + keys = [ + { + icon = " "; + key = "f"; + desc = "Find File"; + action = ":lua Snacks.dashboard.pick('files')"; + } + { + icon = " "; + key = "n"; + desc = "New File"; + action = ":ene | startinsert"; + } + { + icon = " "; + key = "g"; + desc = "Find Text"; + action = ":lua Snacks.dashboard.pick('live_grep')"; + } + { + icon = " "; + key = "r"; + desc = "Recent Files"; + action = ":lua Snacks.dashboard.pick('oldfiles')"; + } + { + icon = " "; + key = "c"; + desc = "Config"; + action = ":lua require('telescope.builtin').find_files({ cwd = '~/nix-config/modules/programs/neovim' })"; + } + { + icon = " "; + key = "s"; + desc = "Restore Session"; + action = ":Telescope persisted"; + } + { + icon = " "; + key = "q"; + desc = "Quit"; + action = ":qa"; + } + ]; + }; + sections = [ + { + section = "header"; + gap = 2; + } + { + section = "keys"; + gap = 1; + padding = 1; + } + ]; + }; + explorer = { + enabled = true; + auto_close = true; + }; + indent.enabled = false; + input.enabled = true; + picker.enabled = true; + notifier.enabled = true; + quickfile.enabled = true; + statuscolumn.enabled = true; + words.enabled = true; + }; + }; + }; +}