From 842479d4e7edf57644aa2613d48b4da61141a0f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Sat, 7 Mar 2026 21:09:42 +0100 Subject: [PATCH] feat: add option for dotfile linking for neovim --- hosts/fw16/configuration.nix | 3 ++ hosts/tower/configuration.nix | 3 ++ modules/home-manager/neovim.nix | 89 ++++++++++++++++++--------------- 3 files changed, 56 insertions(+), 39 deletions(-) diff --git a/hosts/fw16/configuration.nix b/hosts/fw16/configuration.nix index a21a8b3..32a3a3e 100644 --- a/hosts/fw16/configuration.nix +++ b/hosts/fw16/configuration.nix @@ -32,6 +32,9 @@ in base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml"; }; + # neovim manages its own theme + home-manager.users.matej.stylix.targets.neovim.enable = false; + boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/hosts/tower/configuration.nix b/hosts/tower/configuration.nix index b70097b..3099982 100644 --- a/hosts/tower/configuration.nix +++ b/hosts/tower/configuration.nix @@ -34,6 +34,9 @@ base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-medium.yaml"; }; + # neovim manages its own theme + home-manager.users.matej.stylix.targets.neovim.enable = false; + # lanzaboote secure boot boot.kernelParams = [ "btusb.reset=1" ]; boot.loader.efi.canTouchEfiVariables = true; diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix index 39d9617..a6c162d 100644 --- a/modules/home-manager/neovim.nix +++ b/modules/home-manager/neovim.nix @@ -9,51 +9,62 @@ neovim = { enable = lib.mkEnableOption "neovim nightly with lsp support"; package = lib.mkPackageOption pkgs "neovim" { }; + dotfiles = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + description = "path to neovim config directory"; + }; }; }; - config = lib.mkIf config.neovim.enable { - stylix.targets.neovim.enable = false; - programs.neovim = { - enable = true; - vimAlias = true; - defaultEditor = true; - inherit (config.neovim) package; + config = lib.mkIf config.neovim.enable ( + lib.mkMerge [ + (lib.mkIf (config.neovim.dotfiles != null) { + xdg.configFile."nvim".source = config.neovim.dotfiles; + }) + { + programs.neovim = { + enable = true; + vimAlias = true; + defaultEditor = true; + inherit (config.neovim) package; - extraPackages = with pkgs; [ - # runtime deps - gcc - luajit - nodejs_22 - tree-sitter - gnumake - osc + extraPackages = with pkgs; [ + # runtime deps + gcc + luajit + nodejs_22 + tree-sitter + gnumake + osc - # search and diff - fd - ripgrep - bat - delta + # search and diff + fd + ripgrep + bat + delta - # language servers - pyright - typescript-language-server - lua-language-server - gopls - nil - nixd + # language servers + pyright + typescript-language-server + lua-language-server + gopls + nil + nixd - # formatters - nixpkgs-fmt - stylua - ]; + # formatters + nixpkgs-fmt + stylua + ]; - extraWrapperArgs = [ - "--suffix" - "LD_LIBRARY_PATH" - ":" - "${lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib ]}" - ]; - }; - }; + extraWrapperArgs = [ + "--suffix" + "LD_LIBRARY_PATH" + ":" + "${lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib ]}" + ]; + }; + } + ] + ); }