Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions modules/programs/neovim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ in {
'';
};

extraLuaConfig = mkOption {
type = types.lines;
default = "";
example = ''
vim.opt.nobackup = true
'';
description = ''
Custom lua lines.
'';
};

extraPackages = mkOption {
type = with types; listOf package;
default = [ ];
Expand Down Expand Up @@ -394,8 +405,9 @@ in {
"vim.cmd [[source ${
pkgs.writeText "nvim-init-home-manager.vim"
neovimConfig.neovimRcContent
}]]" + lib.optionalString hasLuaConfig
config.programs.neovim.generatedConfigs.lua;
}]]" + config.programs.neovim.extraLuaConfig
+ (lib.optionalString hasLuaConfig
config.programs.neovim.generatedConfigs.lua);
Comment thread
GuillaumeDesforges marked this conversation as resolved.
Outdated
in mkIf (luaRcContent != "") { text = luaRcContent; };

"nvim/coc-settings.json" = mkIf cfg.coc.enable {
Expand Down
1 change: 1 addition & 0 deletions tests/modules/programs/neovim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@

# waiting for a nixpkgs patch
neovim-no-init = ./no-init.nix;
neovim-extra-lua-init = ./extra-lua-init.nix;
}
23 changes: 23 additions & 0 deletions tests/modules/programs/neovim/extra-lua-init.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:

with lib;

{
config = {
programs.neovim = {
enable = true;

extraLuaConfig = ''
-- extraLuaConfig
'';
};
nmt.script = ''
nvimFolder="home-files/.config/nvim"
assertFileContent "$nvimFolder/init.lua" ${
Comment thread
GuillaumeDesforges marked this conversation as resolved.
Outdated
pkgs.writeText "init.lua-expected" ''
-- extraLuaConfig
''
}
'';
};
}