Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 11 additions & 9 deletions modules/top-level/output.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}:
let
inherit (lib) types mkOption mkPackageOption;
inherit (lib) optional optionalString optionalAttrs;
inherit (lib) optional optionalAttrs;
builders = lib.nixvim.builders.withPkgs pkgs;
in
{
Expand Down Expand Up @@ -285,8 +285,10 @@ in
}
);

wrappedNeovim' = pkgs.wrapNeovimUnstable package neovimConfig;

customRC = helpers.concatNonEmptyLines [
(helpers.wrapVimscriptForLua neovimConfig.neovimRcContent)
(helpers.wrapVimscriptForLua wrappedNeovim'.initRc)
config.content
];

Expand Down Expand Up @@ -330,13 +332,13 @@ in
else
config.package;

wrappedNeovim = pkgs.wrapNeovimUnstable package (
neovimConfig
// {
wrapperArgs = lib.escapeShellArgs neovimConfig.wrapperArgs + " " + extraWrapperArgs;
wrapRc = false;
}
);
wrappedNeovim = wrappedNeovim'.override (prev: {
wrapperArgs =
(if lib.isString prev.wrapperArgs then prev.wrapperArgs else lib.escapeShellArgs prev.wrapperArgs)
+ " "
+ extraWrapperArgs;
wrapRc = false;
});
in
{
build = {
Expand Down
24 changes: 19 additions & 5 deletions tests/test-sources/modules/output.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,27 @@
"test.vim" = configs;
};

# Plugin configs
# TODO: Test this makes it to the nvim configuration
# NOTE: config.content currently does not contain extraPlugins config
extraPlugins = [
{
plugin = pkgs.emptyDirectory;
config = "let g:var = 'neovimRcContent5'";
config = "let g:var = 'wrappedNeovim.initRc5'";

# Test that final init.lua contains all config sections
plugin = pkgs.runCommandLocal "init-lua-content-test" { } ''
test_content() {
if ! grep -qF "$1" "${config.build.initFile}"; then
echo "init.lua should contain $2" >&2
exit 1
fi
}

test_content extraConfigLuaPre1 extraConfigLuaPre
test_content extraConfigLua2 extraConfigLua
test_content extraConfigLuaPost3 extraConfigLuaPost
test_content extraConfigVim4 extraConfigVim4
test_content wrappedNeovim.initRc5 wrappedNeovim.initRc

touch $out
'';
}
];

Expand Down