mirror of
https://github.com/nix-community/nixvim.git
synced 2026-08-24 10:14:03 -05:00
modules/top-level/output: add autowrapRuntimeDeps
Support user's overriding the wrapper behavior for wrapping runtime deps from nixpkgs. Default to enabled, matching the wrapper.
This commit is contained in:
@@ -13,6 +13,14 @@ let
|
||||
in
|
||||
{
|
||||
options = {
|
||||
autowrapRuntimeDeps = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to automatically add plugin runtime dependencies to the Neovim wrapper's `PATH`.
|
||||
'';
|
||||
};
|
||||
|
||||
viAlias = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
@@ -212,6 +220,7 @@ in
|
||||
(pkgs.wrapNeovimUnstable package {
|
||||
extraLuaPackages = luaPackagesForWrapper;
|
||||
inherit (config)
|
||||
autowrapRuntimeDeps
|
||||
extraPython3Packages
|
||||
viAlias
|
||||
vimAlias
|
||||
|
||||
@@ -161,4 +161,57 @@
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
autowrapRuntimeDeps =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
plugin = pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "nixvim-runtime-deps-test";
|
||||
version = "1";
|
||||
src = pkgs.runCommandLocal "nixvim-runtime-deps-test-src" { } "mkdir -p $out";
|
||||
runtimeDeps = [ pkgs.hello ];
|
||||
};
|
||||
in
|
||||
{
|
||||
extraPlugins = [ plugin ];
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = lib.elem pkgs.hello config.build.nvimPackage.runtimeDeps;
|
||||
message = "`autowrapRuntimeDeps` should add plugin runtime dependencies by default.";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
autowrapRuntimeDeps-disabled =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
plugin = pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "nixvim-runtime-deps-disabled-test";
|
||||
version = "1";
|
||||
src = pkgs.runCommandLocal "nixvim-runtime-deps-disabled-test-src" { } "mkdir -p $out";
|
||||
runtimeDeps = [ pkgs.hello ];
|
||||
};
|
||||
in
|
||||
{
|
||||
autowrapRuntimeDeps = false;
|
||||
extraPlugins = [ plugin ];
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = !lib.elem pkgs.hello config.build.nvimPackage.runtimeDeps;
|
||||
message = "`autowrapRuntimeDeps = false` should not add plugin runtime dependencies.";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user