From 6f0e167087ab5bab4dde59ce8f2994bbf609188c Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Wed, 29 May 2024 13:40:03 -0500 Subject: [PATCH] added enable option to nvim changed home-manager personal config namespace from home.* to user.* --- hosts/archlaptop-vm/default.nix | 2 +- hosts/home-personal.nix | 6 +- hosts/home-workstation.nix | 2 +- hosts/workstation-vm/default.nix | 11 +- hosts/wsl-workstation.nix | 2 +- modules/home-manager/nvim/cmp/default.nix | 11 +- modules/home-manager/nvim/default.nix | 38 +-- modules/home-manager/nvim/gitsigns.nix | 39 ++-- modules/home-manager/nvim/keybinds.nix | 183 ++++++++------- modules/home-manager/nvim/lsp/clangd.nix | 58 ++--- modules/home-manager/nvim/lsp/default.nix | 8 +- modules/home-manager/nvim/lsp/rust-tools.nix | 2 +- modules/home-manager/nvim/lualine.nix | 135 +++++------ modules/home-manager/nvim/nvim-tree.nix | 51 ++-- modules/home-manager/nvim/options.nix | 124 +++++----- modules/home-manager/nvim/simpleplugins.nix | 31 +-- modules/home-manager/nvim/telescope.nix | 221 +++++++++--------- modules/home-manager/nvim/toggleterm.nix | 61 ++--- .../home-manager/nvim/treesitter/arial.nix | 2 +- .../home-manager/nvim/treesitter/default.nix | 15 +- .../nvim/treesitter/rainbow-delimiters.nix | 2 +- .../nvim/treesitter/tree-sitter-nu.nix | 2 +- modules/home-manager/nvim/which-key.nix | 19 +- modules/home-manager/terminal/git.nix | 10 +- modules/home-manager/terminal/starship.nix | 2 +- modules/home-manager/terminal/voice.nix | 4 +- roles/home-manager/minimal-terminal.nix | 4 + roles/home-manager/terminal.nix | 7 +- roles/nixos/gaming.nix | 6 +- templates/default.nix | 6 +- 30 files changed, 539 insertions(+), 525 deletions(-) diff --git a/hosts/archlaptop-vm/default.nix b/hosts/archlaptop-vm/default.nix index 5a1e31d..706e8e3 100644 --- a/hosts/archlaptop-vm/default.nix +++ b/hosts/archlaptop-vm/default.nix @@ -60,7 +60,7 @@ inputs.nixpkgs.lib.nixosSystem { ... }: { host = osConfig.host; - home = { + user = { git = { profile = { name = "Gabe Venberg"; diff --git a/hosts/home-personal.nix b/hosts/home-personal.nix index a848dc5..8f8643b 100644 --- a/hosts/home-personal.nix +++ b/hosts/home-personal.nix @@ -14,12 +14,8 @@ inputs.home-manager.lib.homeManagerConfiguration { ... }: { # machine specific options - home = { + user = { enable-speech = true; - nvim = { - enable-lsp = true; - enable-treesitter = true; - }; git = { profile = { name = "Gabe Venberg"; diff --git a/hosts/home-workstation.nix b/hosts/home-workstation.nix index f3e0d06..d4e1b93 100644 --- a/hosts/home-workstation.nix +++ b/hosts/home-workstation.nix @@ -15,7 +15,7 @@ inputs.home-manager.lib.homeManagerConfiguration { ... }: { # machine specific options - home = { + user = { nvim = { enable-lsp = true; enable-treesitter = true; diff --git a/hosts/workstation-vm/default.nix b/hosts/workstation-vm/default.nix index b411ee7..91ce433 100644 --- a/hosts/workstation-vm/default.nix +++ b/hosts/workstation-vm/default.nix @@ -65,11 +65,7 @@ inputs.nixpkgs.lib.nixosSystem { ... }: { host = osConfig.host; - home = { - nvim = { - enable-lsp = true; - enable-treesitter = true; - }; + user = { git = { profile = { name = "Gabe Venberg"; @@ -87,11 +83,6 @@ inputs.nixpkgs.lib.nixosSystem { # Enable the OpenSSH daemon. services.openssh.enable = true; - services.nfs.server = { - enable = true; - exports = "/srv/nfs *(rw,sync,no_root_squash,no_subtree_check)"; - }; - # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/hosts/wsl-workstation.nix b/hosts/wsl-workstation.nix index 93d97b5..8d5aa5c 100644 --- a/hosts/wsl-workstation.nix +++ b/hosts/wsl-workstation.nix @@ -41,7 +41,7 @@ inputs.nixpkgs.lib.nixosSystem { ... }: { host = osConfig.host; - home = { + user = { nvim = { enable-lsp = true; enable-treesitter = true; diff --git a/modules/home-manager/nvim/cmp/default.nix b/modules/home-manager/nvim/cmp/default.nix index f2ddce5..0089c1e 100644 --- a/modules/home-manager/nvim/cmp/default.nix +++ b/modules/home-manager/nvim/cmp/default.nix @@ -4,15 +4,10 @@ lib, ... }: { - options = { - home.nvim.enable-completions = - (lib.mkEnableOption "basic completion in nvim") - // { - default = false; - }; - }; + options.user.nvim.enable-completions = lib.mkEnableOption "basic completion in nvim"; + config = - lib.mkIf config.home.nvim.enable-completions + lib.mkIf (config.user.nvim.enable-completions && config.user.nvim.enable) { programs.nixvim = { plugins.luasnip.enable = true; diff --git a/modules/home-manager/nvim/default.nix b/modules/home-manager/nvim/default.nix index 58f2433..1f873df 100644 --- a/modules/home-manager/nvim/default.nix +++ b/modules/home-manager/nvim/default.nix @@ -3,29 +3,33 @@ pkgs, helpers, lib, + config, ... }: { - programs.nixvim = { - enable = true; - viAlias = true; - vimAlias = true; - - colorschemes.base16 = { - colorscheme = "gruvbox-dark-medium"; + options.user.nvim.enable = lib.mkEnableOption "enable nvim"; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { enable = true; + viAlias = true; + vimAlias = true; + + colorschemes.base16 = { + colorscheme = "gruvbox-dark-medium"; + enable = true; + }; + + clipboard.providers.xsel.enable = true; + }; + home.sessionVariables = { + EDITOR = "nvim"; + VISUAL = "nvim"; }; - clipboard.providers.xsel.enable = true; + programs.nushell.extraEnv = '' + $env.EDITOR = nvim + $env.VISUAL = nvim + ''; }; - home.sessionVariables = { - EDITOR = "nvim"; - VISUAL = "nvim"; - }; - - programs.nushell.extraEnv = '' - $env.EDITOR = nvim - $env.VISUAL = nvim - ''; imports = [ ./keybinds.nix diff --git a/modules/home-manager/nvim/gitsigns.nix b/modules/home-manager/nvim/gitsigns.nix index 3f24cd6..9689164 100644 --- a/modules/home-manager/nvim/gitsigns.nix +++ b/modules/home-manager/nvim/gitsigns.nix @@ -1,25 +1,28 @@ { - configs, + config, + lib, pkgs, ... }: { - programs.nixvim = { - plugins.gitsigns = { - enable = true; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { + plugins.gitsigns = { + enable = true; + }; + plugins.which-key.registrations = { + "g" = "+git"; + }; + keymaps = [ + { + action = ":Gitsigns toggle_current_line_blame"; + key = "gb"; + mode = "n"; + options = { + silent = true; + desc = "toggle git blame"; + }; + } + ]; }; - plugins.which-key.registrations = { - "g" = "+git"; - }; - keymaps = [ - { - action = ":Gitsigns toggle_current_line_blame"; - key = "gb"; - mode = "n"; - options = { - silent = true; - desc = "toggle git blame"; - }; - } - ]; }; } diff --git a/modules/home-manager/nvim/keybinds.nix b/modules/home-manager/nvim/keybinds.nix index f10067e..4d0b714 100644 --- a/modules/home-manager/nvim/keybinds.nix +++ b/modules/home-manager/nvim/keybinds.nix @@ -1,97 +1,100 @@ { - configs, + config, + lib, pkgs, ... }: { - programs.nixvim = { - globals = { - mapleader = ";"; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { + globals = { + mapleader = ";"; + }; + plugins.which-key.registrations = { + "c" = "+check"; + }; + keymaps = [ + { + action = ":setlocal spell!"; + key = "cs"; + mode = "n"; + options = { + silent = true; + desc = "toggle spell check"; + }; + } + { + action = ":bnext"; + key = "gf"; + mode = "n"; + options = { + silent = true; + desc = "next buffer"; + }; + } + { + action = ":bprevious"; + key = "gF"; + mode = "n"; + options = { + silent = true; + desc = "prev buffer"; + }; + } + { + action = "h"; + key = ""; + mode = "n"; + options = { + silent = true; + desc = "move to right split"; + }; + } + { + action = "j"; + key = ""; + mode = "n"; + options = { + silent = true; + desc = "move to below split"; + }; + } + { + action = "k"; + key = ""; + mode = "n"; + options = { + silent = true; + desc = "move to above split"; + }; + } + { + action = "l"; + key = ""; + mode = "n"; + options = { + silent = true; + desc = "move to left split"; + }; + } + { + action = "za"; + key = ""; + mode = "n"; + options = { + silent = true; + desc = "toggle fold"; + }; + } + { + action = ":nohls"; + key = "h"; + mode = "n"; + options = { + silent = true; + desc = "clear highlighting"; + }; + } + ]; }; - plugins.which-key.registrations = { - "c" = "+check"; - }; - keymaps = [ - { - action = ":setlocal spell!"; - key = "cs"; - mode = "n"; - options = { - silent = true; - desc = "toggle spell check"; - }; - } - { - action = ":bnext"; - key = "gf"; - mode = "n"; - options = { - silent = true; - desc = "next buffer"; - }; - } - { - action = ":bprevious"; - key = "gF"; - mode = "n"; - options = { - silent = true; - desc = "prev buffer"; - }; - } - { - action = "h"; - key = ""; - mode = "n"; - options = { - silent = true; - desc = "move to right split"; - }; - } - { - action = "j"; - key = ""; - mode = "n"; - options = { - silent = true; - desc = "move to below split"; - }; - } - { - action = "k"; - key = ""; - mode = "n"; - options = { - silent = true; - desc = "move to above split"; - }; - } - { - action = "l"; - key = ""; - mode = "n"; - options = { - silent = true; - desc = "move to left split"; - }; - } - { - action = "za"; - key = ""; - mode = "n"; - options = { - silent = true; - desc = "toggle fold"; - }; - } - { - action = ":nohls"; - key = "h"; - mode = "n"; - options = { - silent = true; - desc = "clear highlighting"; - }; - } - ]; }; } diff --git a/modules/home-manager/nvim/lsp/clangd.nix b/modules/home-manager/nvim/lsp/clangd.nix index 9e9daff..8229785 100644 --- a/modules/home-manager/nvim/lsp/clangd.nix +++ b/modules/home-manager/nvim/lsp/clangd.nix @@ -4,32 +4,16 @@ lib, ... }: { - home.file = { - ".clangd".text = '' - # keeps clangd from choking when it sees a compiler flag for a different - # compiler. (sutch as when acting as an lsp for a project that uses GCC.) - CompileFlags: - Add: -Wno-unknown-warning-option - Remove: [-m*, -f*] - ''; - ".clang-format".text = '' - --- - #this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other. - PointerAlignment: Left - ColumnLimit: 80 - IndentWidth: 4 - TabWidth: 4 - UseCRLF: false - UseTab: Never - AlignAfterOpenBracket: BlockIndent - AlwaysBreakBeforeMultilineStrings: true - BreakBeforeBraces: Attach - AlignOperands: Align - BreakBeforeBinaryOperators: NonAssignment - ... - ''; - "work/.clang-format" = lib.mkIf config.home.git.workProfile.enable { - text = '' + config = lib.mkIf (config.user.nvim.enable && config.user.nvim.enable-lsp) { + home.file = { + ".clangd".text = '' + # keeps clangd from choking when it sees a compiler flag for a different + # compiler. (sutch as when acting as an lsp for a project that uses GCC.) + CompileFlags: + Add: -Wno-unknown-warning-option + Remove: [-m*, -f*] + ''; + ".clang-format".text = '' --- #this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other. PointerAlignment: Left @@ -40,10 +24,28 @@ UseTab: Never AlignAfterOpenBracket: BlockIndent AlwaysBreakBeforeMultilineStrings: true - BreakBeforeBraces: Allman - BreakBeforeBinaryOperators: None + BreakBeforeBraces: Attach + AlignOperands: Align + BreakBeforeBinaryOperators: NonAssignment ... ''; + "work/.clang-format" = lib.mkIf config.user.git.workProfile.enable { + text = '' + --- + #this syncronizes with settings used by neovims treesitters so that the lsp formatting and treesitter formatting do not fight eatch other. + PointerAlignment: Left + ColumnLimit: 80 + IndentWidth: 4 + TabWidth: 4 + UseCRLF: false + UseTab: Never + AlignAfterOpenBracket: BlockIndent + AlwaysBreakBeforeMultilineStrings: true + BreakBeforeBraces: Allman + BreakBeforeBinaryOperators: None + ... + ''; + }; }; }; } diff --git a/modules/home-manager/nvim/lsp/default.nix b/modules/home-manager/nvim/lsp/default.nix index 19b98ff..5720d07 100644 --- a/modules/home-manager/nvim/lsp/default.nix +++ b/modules/home-manager/nvim/lsp/default.nix @@ -4,14 +4,12 @@ lib, ... }: { - options = { - home.nvim.enable-lsp = lib.mkEnableOption "nvim lsp"; - }; + options.user.nvim.enable-lsp = lib.mkEnableOption "nvim lsp"; config = - lib.mkIf config.home.nvim.enable-lsp + lib.mkIf (config.user.nvim.enable-lsp && config.user.nvim.enable) { - home.nvim.enable-completions = true; + user.nvim.enable-completions = true; programs.nixvim = { plugins.lsp = { enable = true; diff --git a/modules/home-manager/nvim/lsp/rust-tools.nix b/modules/home-manager/nvim/lsp/rust-tools.nix index aa86805..8587d55 100644 --- a/modules/home-manager/nvim/lsp/rust-tools.nix +++ b/modules/home-manager/nvim/lsp/rust-tools.nix @@ -5,7 +5,7 @@ ... }: { config = - lib.mkIf config.home.nvim.enable-lsp + lib.mkIf (config.user.nvim.enable-lsp && config.user.nvim.enable) { programs.nixvim = { plugins.rust-tools = { diff --git a/modules/home-manager/nvim/lualine.nix b/modules/home-manager/nvim/lualine.nix index 0a9eea1..9ff5bfd 100644 --- a/modules/home-manager/nvim/lualine.nix +++ b/modules/home-manager/nvim/lualine.nix @@ -1,76 +1,79 @@ { - configs, + config, + lib, pkgs, ... }: { - programs.nixvim = { - plugins.lualine = { - enable = true; - alwaysDivideMiddle = true; - iconsEnabled = true; - sections = { - lualine_a = [ - {name = "mode";} - ]; - lualine_b = [ - {name = "branch";} - {name = "diff";} - {name = "diagnostics";} - ]; - lualine_c = [ - { - name = "filename"; - extraConfig = {path = 1;}; - } - ]; - lualine_x = [ - {name = "encoding";} - {name = "fileformat";} - {name = "filetype";} - ]; - lualine_y = [ - {name = "progress";} - ]; - lualine_z = [ - {name = "location";} - ]; - }; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { + plugins.lualine = { + enable = true; + alwaysDivideMiddle = true; + iconsEnabled = true; + sections = { + lualine_a = [ + {name = "mode";} + ]; + lualine_b = [ + {name = "branch";} + {name = "diff";} + {name = "diagnostics";} + ]; + lualine_c = [ + { + name = "filename"; + extraConfig = {path = 1;}; + } + ]; + lualine_x = [ + {name = "encoding";} + {name = "fileformat";} + {name = "filetype";} + ]; + lualine_y = [ + {name = "progress";} + ]; + lualine_z = [ + {name = "location";} + ]; + }; - inactiveSections = { - lualine_a = []; - lualine_b = []; - lualine_c = [{name = "filename";}]; - lualine_x = [{name = "filetype";}]; - lualine_y = []; - lualine_z = []; - }; + inactiveSections = { + lualine_a = []; + lualine_b = []; + lualine_c = [{name = "filename";}]; + lualine_x = [{name = "filetype";}]; + lualine_y = []; + lualine_z = []; + }; - tabline = { - lualine_a = [ - { - name = "buffers"; - extraConfig = {mode = 4;}; - } - ]; - lualine_b = []; - lualine_c = []; - lualine_x = []; - lualine_y = []; - lualine_z = [ - { - name = "tabs"; - extraConfig = {mode = 2;}; - } - ]; - }; + tabline = { + lualine_a = [ + { + name = "buffers"; + extraConfig = {mode = 4;}; + } + ]; + lualine_b = []; + lualine_c = []; + lualine_x = []; + lualine_y = []; + lualine_z = [ + { + name = "tabs"; + extraConfig = {mode = 2;}; + } + ]; + }; - winbar = { - lualine_a = []; - lualine_b = []; - lualine_c = []; - lualine_x = []; - lualine_y = []; - lualine_z = []; + winbar = { + lualine_a = []; + lualine_b = []; + lualine_c = []; + lualine_x = []; + lualine_y = []; + lualine_z = []; + }; }; }; }; diff --git a/modules/home-manager/nvim/nvim-tree.nix b/modules/home-manager/nvim/nvim-tree.nix index 16c60aa..b7bb910 100644 --- a/modules/home-manager/nvim/nvim-tree.nix +++ b/modules/home-manager/nvim/nvim-tree.nix @@ -1,31 +1,34 @@ { - configs, + config, + lib, pkgs, ... }: { - programs.nixvim = { - plugins.nvim-tree = { - enable = true; - disableNetrw = true; - hijackCursor = true; - hijackNetrw = true; - hijackUnnamedBufferWhenOpening = true; - actions = { - useSystemClipboard = true; - changeDir.enable = true; - }; - filesystemWatchers.enable = true; - }; - keymaps = [ - { - action = ":NvimTreeToggle"; - key = "t"; - mode = "n"; - options = { - silent = true; - desc = "toggle file browser"; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { + plugins.nvim-tree = { + enable = true; + disableNetrw = true; + hijackCursor = true; + hijackNetrw = true; + hijackUnnamedBufferWhenOpening = true; + actions = { + useSystemClipboard = true; + changeDir.enable = true; }; - } - ]; + filesystemWatchers.enable = true; + }; + keymaps = [ + { + action = ":NvimTreeToggle"; + key = "t"; + mode = "n"; + options = { + silent = true; + desc = "toggle file browser"; + }; + } + ]; + }; }; } diff --git a/modules/home-manager/nvim/options.nix b/modules/home-manager/nvim/options.nix index bb1f0b2..d0760f3 100644 --- a/modules/home-manager/nvim/options.nix +++ b/modules/home-manager/nvim/options.nix @@ -1,70 +1,72 @@ { - configs, + config, pkgs, lib, ... }: { - programs.nixvim = { - opts = { - mouse = "a"; - lazyredraw = true; - termguicolors = true; - autoread = true; - swapfile = false; - history = 500; - formatoptions = "rojq"; - # dont hard wrap - textwidth = 0; - wrapmargin = 0; - breakindent = true; - # highlight after col - colorcolumn = "80,100,120"; - # add ruler to side of screen - number = true; - numberwidth = 3; - #display cursor cordinates - ruler = true; - #always leave 5 cells between cursor and side of window - scrolloff = 5; - # better command line completion - wildmenu = true; - # ignore case if all lowercase - ignorecase = true; - smartcase = true; - # show unfinished keycombos in statusbar - showcmd = true; - # regex stuff - magic = true; - # always show statusline - laststatus = 2; - # tab stuff - tabstop = 4; - shiftwidth = 0; - autoindent = true; - smartindent = true; - smarttab = true; - # for true tabs, change to false - expandtab = true; - softtabstop = -1; - # highlight search results as you type - hlsearch = true; - incsearch = true; - # folding stuff - foldlevelstart = 5; - foldmethod = lib.mkDefault "indent"; - foldcolumn = "auto:4"; - foldenable = true; - # display whitespace as other chars - list = true; - listchars = { - tab = ">-"; - eol = "↲"; - nbsp = "␣"; - trail = "•"; - extends = "⟩"; - precedes = "⟨"; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { + opts = { + mouse = "a"; + lazyredraw = true; + termguicolors = true; + autoread = true; + swapfile = false; + history = 500; + formatoptions = "rojq"; + # dont hard wrap + textwidth = 0; + wrapmargin = 0; + breakindent = true; + # highlight after col + colorcolumn = "80,100,120"; + # add ruler to side of screen + number = true; + numberwidth = 3; + #display cursor cordinates + ruler = true; + #always leave 5 cells between cursor and side of window + scrolloff = 5; + # better command line completion + wildmenu = true; + # ignore case if all lowercase + ignorecase = true; + smartcase = true; + # show unfinished keycombos in statusbar + showcmd = true; + # regex stuff + magic = true; + # always show statusline + laststatus = 2; + # tab stuff + tabstop = 4; + shiftwidth = 0; + autoindent = true; + smartindent = true; + smarttab = true; + # for true tabs, change to false + expandtab = true; + softtabstop = -1; + # highlight search results as you type + hlsearch = true; + incsearch = true; + # folding stuff + foldlevelstart = 5; + foldmethod = lib.mkDefault "indent"; + foldcolumn = "auto:4"; + foldenable = true; + # display whitespace as other chars + list = true; + listchars = { + tab = ">-"; + eol = "↲"; + nbsp = "␣"; + trail = "•"; + extends = "⟩"; + precedes = "⟨"; + }; + showbreak = "↪"; }; - showbreak = "↪"; }; }; } diff --git a/modules/home-manager/nvim/simpleplugins.nix b/modules/home-manager/nvim/simpleplugins.nix index bf49c98..6e594ef 100644 --- a/modules/home-manager/nvim/simpleplugins.nix +++ b/modules/home-manager/nvim/simpleplugins.nix @@ -1,21 +1,24 @@ { - configs, + config, + lib, pkgs, ... }: { - programs.nixvim = { - plugins.comment.enable = true; - plugins.marks.enable = true; - plugins.surround.enable = true; - plugins.todo-comments.enable = true; - plugins.leap = { - enable = true; - addDefaultMappings = true; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { + plugins.comment.enable = true; + plugins.marks.enable = true; + plugins.surround.enable = true; + plugins.todo-comments.enable = true; + plugins.leap = { + enable = true; + addDefaultMappings = true; + }; + extraPlugins = with pkgs.vimPlugins; [ + vim-numbertoggle + dressing-nvim + ]; + extraConfigLua = ''require("dressing").setup({})''; }; - extraPlugins = with pkgs.vimPlugins; [ - vim-numbertoggle - dressing-nvim - ]; - extraConfigLua = ''require("dressing").setup({})''; }; } diff --git a/modules/home-manager/nvim/telescope.nix b/modules/home-manager/nvim/telescope.nix index ffda359..887654d 100644 --- a/modules/home-manager/nvim/telescope.nix +++ b/modules/home-manager/nvim/telescope.nix @@ -1,116 +1,119 @@ { - configs, + config, + lib, pkgs, ... }: { - programs.nixvim = { - plugins.telescope = { - enable = true; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { + plugins.telescope = { + enable = true; + }; + plugins.which-key.registrations = { + "f" = "+telescope"; + "fg" = "+telescope git"; + }; + keymaps = [ + { + action = ":Telescope find_files"; + key = "ff"; + mode = "n"; + options = { + silent = true; + desc = "files"; + }; + } + { + action = ":Telescope live_grep"; + key = "fg"; + mode = "n"; + options = { + silent = true; + desc = "grep"; + }; + } + { + action = ":Telescope buffers"; + key = "fb"; + mode = "n"; + options = { + silent = true; + desc = "buffers"; + }; + } + { + action = ":Telescope marks"; + key = "fm"; + mode = "n"; + options = { + silent = true; + desc = "marks"; + }; + } + { + action = ":Telescope registers"; + key = "fr"; + mode = "n"; + options = { + silent = true; + desc = "registers"; + }; + } + { + action = ":Telescope keymaps"; + key = "fk"; + mode = "n"; + options = { + silent = true; + desc = "keymaps"; + }; + } + { + action = ":Telescope current_buffer_fuzzy_find"; + key = "fz"; + mode = "n"; + options = { + silent = true; + desc = "fuzzy find"; + }; + } + { + action = ":Telescope git_commits"; + key = "fgc"; + mode = "n"; + options = { + silent = true; + desc = "commits"; + }; + } + { + action = ":Telescope git_branches"; + key = "fgb"; + mode = "n"; + options = { + silent = true; + desc = "branches"; + }; + } + { + action = ":Telescope git_stash"; + key = "fgs"; + mode = "n"; + options = { + silent = true; + desc = "stash"; + }; + } + { + action = ":Telescope git_commits"; + key = "fgc"; + mode = "n"; + options = { + silent = true; + desc = "commits"; + }; + } + ]; }; - plugins.which-key.registrations = { - "f" = "+telescope"; - "fg" = "+telescope git"; - }; - keymaps = [ - { - action = ":Telescope find_files"; - key = "ff"; - mode = "n"; - options = { - silent = true; - desc = "files"; - }; - } - { - action = ":Telescope live_grep"; - key = "fg"; - mode = "n"; - options = { - silent = true; - desc = "grep"; - }; - } - { - action = ":Telescope buffers"; - key = "fb"; - mode = "n"; - options = { - silent = true; - desc = "buffers"; - }; - } - { - action = ":Telescope marks"; - key = "fm"; - mode = "n"; - options = { - silent = true; - desc = "marks"; - }; - } - { - action = ":Telescope registers"; - key = "fr"; - mode = "n"; - options = { - silent = true; - desc = "registers"; - }; - } - { - action = ":Telescope keymaps"; - key = "fk"; - mode = "n"; - options = { - silent = true; - desc = "keymaps"; - }; - } - { - action = ":Telescope current_buffer_fuzzy_find"; - key = "fz"; - mode = "n"; - options = { - silent = true; - desc = "fuzzy find"; - }; - } - { - action = ":Telescope git_commits"; - key = "fgc"; - mode = "n"; - options = { - silent = true; - desc = "commits"; - }; - } - { - action = ":Telescope git_branches"; - key = "fgb"; - mode = "n"; - options = { - silent = true; - desc = "branches"; - }; - } - { - action = ":Telescope git_stash"; - key = "fgs"; - mode = "n"; - options = { - silent = true; - desc = "stash"; - }; - } - { - action = ":Telescope git_commits"; - key = "fgc"; - mode = "n"; - options = { - silent = true; - desc = "commits"; - }; - } - ]; }; } diff --git a/modules/home-manager/nvim/toggleterm.nix b/modules/home-manager/nvim/toggleterm.nix index b48df86..676497d 100644 --- a/modules/home-manager/nvim/toggleterm.nix +++ b/modules/home-manager/nvim/toggleterm.nix @@ -1,36 +1,39 @@ { - configs, + config, + lib, pkgs, ... }: { - programs.nixvim = { - plugins.toggleterm = { - enable = true; - settings = { - direction = "horizontal"; - insert_mappings = false; - terminal_mappings = false; - open_mapping = ''[[]]''; - }; - }; - keymaps = [ - { - action = "function() Floatingterm:toggle() end"; - key = "s"; - lua = true; - mode = "n"; - options = { - silent = true; - desc = "toggle scratch terminal"; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { + plugins.toggleterm = { + enable = true; + settings = { + direction = "horizontal"; + insert_mappings = false; + terminal_mappings = false; + open_mapping = ''[[]]''; }; - } - ]; - extraConfigLuaPre = '' - local Terminal = require('toggleterm.terminal').Terminal - Floatingterm = Terminal:new({ - hidden = true, - direction = "float" - }) - ''; + }; + keymaps = [ + { + action = "function() Floatingterm:toggle() end"; + key = "s"; + lua = true; + mode = "n"; + options = { + silent = true; + desc = "toggle scratch terminal"; + }; + } + ]; + extraConfigLuaPre = '' + local Terminal = require('toggleterm.terminal').Terminal + Floatingterm = Terminal:new({ + hidden = true, + direction = "float" + }) + ''; + }; }; } diff --git a/modules/home-manager/nvim/treesitter/arial.nix b/modules/home-manager/nvim/treesitter/arial.nix index ffea439..953cdd9 100644 --- a/modules/home-manager/nvim/treesitter/arial.nix +++ b/modules/home-manager/nvim/treesitter/arial.nix @@ -5,7 +5,7 @@ ... }: { config = - lib.mkIf config.home.nvim.enable-treesitter + lib.mkIf (config.user.nvim.enable-treesitter && config.user.nvim.enable) { programs.nixvim = { keymaps = [ diff --git a/modules/home-manager/nvim/treesitter/default.nix b/modules/home-manager/nvim/treesitter/default.nix index 16655c0..080fbd2 100644 --- a/modules/home-manager/nvim/treesitter/default.nix +++ b/modules/home-manager/nvim/treesitter/default.nix @@ -4,19 +4,12 @@ lib, ... }: { - options = { - home.nvim.enable-treesitter = lib.mkOption { - default = false; - type = lib.types.bool; - description = '' - enable nvim treesitter - ''; - }; - }; + options.user.nvim.enable-treesitter = lib.mkEnableOption "enable nvim treesitter"; + config = - lib.mkIf config.home.nvim.enable-treesitter + lib.mkIf (config.user.nvim.enable-treesitter && config.user.nvim.enable) { - home.nvim.enable-completions = true; + user.nvim.enable-completions = true; programs.nixvim = { plugins.treesitter = { enable = true; diff --git a/modules/home-manager/nvim/treesitter/rainbow-delimiters.nix b/modules/home-manager/nvim/treesitter/rainbow-delimiters.nix index e120237..312775f 100644 --- a/modules/home-manager/nvim/treesitter/rainbow-delimiters.nix +++ b/modules/home-manager/nvim/treesitter/rainbow-delimiters.nix @@ -5,7 +5,7 @@ ... }: { config = - lib.mkIf config.home.nvim.enable-treesitter + lib.mkIf (config.user.nvim.enable-treesitter && config.user.nvim.enable) { programs.nixvim = { plugins.rainbow-delimiters = { diff --git a/modules/home-manager/nvim/treesitter/tree-sitter-nu.nix b/modules/home-manager/nvim/treesitter/tree-sitter-nu.nix index f10e68e..c96d70e 100644 --- a/modules/home-manager/nvim/treesitter/tree-sitter-nu.nix +++ b/modules/home-manager/nvim/treesitter/tree-sitter-nu.nix @@ -5,7 +5,7 @@ ... }: { config = - lib.mkIf config.home.nvim.enable-treesitter + lib.mkIf (config.user.nvim.enable-treesitter && config.user.nvim.enable) { programs.nixvim = let nu-grammar = pkgs.tree-sitter.buildGrammar { diff --git a/modules/home-manager/nvim/which-key.nix b/modules/home-manager/nvim/which-key.nix index 13c0ec6..f340a0c 100644 --- a/modules/home-manager/nvim/which-key.nix +++ b/modules/home-manager/nvim/which-key.nix @@ -1,15 +1,18 @@ { - configs, + config, + lib, pkgs, ... }: { - programs.nixvim = { - opts = { - timeout = true; - timeoutlen = 300; - }; - plugins.which-key = { - enable = true; + config = lib.mkIf config.user.nvim.enable { + programs.nixvim = { + opts = { + timeout = true; + timeoutlen = 300; + }; + plugins.which-key = { + enable = true; + }; }; }; } diff --git a/modules/home-manager/terminal/git.nix b/modules/home-manager/terminal/git.nix index ae4ab4e..6df9f94 100644 --- a/modules/home-manager/terminal/git.nix +++ b/modules/home-manager/terminal/git.nix @@ -5,7 +5,7 @@ ... }: { options = { - home.git = { + user.git = { workProfile = { enable = lib.mkEnableOption "git work profile"; email = lib.mkOption { @@ -45,8 +45,8 @@ }; # difftastic.enable=true; # difftastic.background="dark"; - userEmail = config.home.git.profile.email; - userName = config.home.git.profile.name; + userEmail = config.user.git.profile.email; + userName = config.user.git.profile.name; extraConfig = { init = { defaultBranch = "main"; @@ -75,11 +75,11 @@ }; }; includes = - if config.home.git.workProfile.enable + if config.user.git.workProfile.enable then [ { condition = "gitdir:~/work/**"; - contents.user.email = config.home.git.workProfile.email; + contents.user.email = config.user.git.workProfile.email; } ] else []; diff --git a/modules/home-manager/terminal/starship.nix b/modules/home-manager/terminal/starship.nix index 5f8ec50..2ecab45 100644 --- a/modules/home-manager/terminal/starship.nix +++ b/modules/home-manager/terminal/starship.nix @@ -46,7 +46,7 @@ hostname = { ssh_only = false; ssh_symbol = "🌐"; - format = "[$hostname$ssh_symbol]($style)"; + format = "[$hostname $ssh_symbol]($style)"; style = "bg:color_orange"; }; shell = { diff --git a/modules/home-manager/terminal/voice.nix b/modules/home-manager/terminal/voice.nix index 741cbf4..d0f9373 100644 --- a/modules/home-manager/terminal/voice.nix +++ b/modules/home-manager/terminal/voice.nix @@ -5,11 +5,11 @@ ... }: { options = { - home.enable-speech = lib.mkEnableOption "espeak"; + user.enable-speech = lib.mkEnableOption "espeak"; }; config = - lib.mkIf config.home.enable-speech + lib.mkIf config.user.enable-speech { home.shellAliases = { say = "espeak -p 10 -s 150 -a 200"; diff --git a/roles/home-manager/minimal-terminal.nix b/roles/home-manager/minimal-terminal.nix index b9b51e1..a82ee00 100644 --- a/roles/home-manager/minimal-terminal.nix +++ b/roles/home-manager/minimal-terminal.nix @@ -11,7 +11,11 @@ ../../modules/home-manager/terminal/ssh-agent.nix ../../modules/home-manager/terminal/direnv.nix ../../modules/home-manager/terminal/btop.nix + ../../modules/home-manager/nvim ]; + + user.nvim.enable = true; + home.packages = with pkgs; [ sshfs just diff --git a/roles/home-manager/terminal.nix b/roles/home-manager/terminal.nix index cdcf81e..c73de3a 100644 --- a/roles/home-manager/terminal.nix +++ b/roles/home-manager/terminal.nix @@ -9,8 +9,13 @@ ../../modules/home-manager/terminal/nushell ../../modules/home-manager/terminal/starship.nix ../../modules/home-manager/terminal/tiny-irc.nix - ../../modules/home-manager/nvim ]; + + user.nvim = { + enable-lsp = true; + enable-treesitter = true; + }; + home.packages = with pkgs; [ tre-command diskonaut diff --git a/roles/nixos/gaming.nix b/roles/nixos/gaming.nix index e42ddde..d1ca8ab 100644 --- a/roles/nixos/gaming.nix +++ b/roles/nixos/gaming.nix @@ -6,12 +6,12 @@ }: { programs.steam = { enable = true; - extraCompatPackages = with pkgs;[ + extraCompatPackages = with pkgs; [ proton-ge-bin ]; - gamescopeSession.enable=true; + gamescopeSession.enable = true; }; - programs.gamemode.enable=true; + programs.gamemode.enable = true; hardware.steam-hardware.enable = true; } diff --git a/templates/default.nix b/templates/default.nix index 312379a..327c134 100644 --- a/templates/default.nix +++ b/templates/default.nix @@ -3,9 +3,9 @@ outputs, ... }: { - default={ - path=./default; - description="a basic blank devshell flake"; + default = { + path = ./default; + description = "a basic blank devshell flake"; }; hugo = { path = ./hugo;