mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
standalone: Fix extraSpecialArgs (#799)
This commit fixes the usage of `extraSpecialArgs` for standalone nixvim installations and adds a test to ensure this. Fixes #779
This commit is contained in:
parent
dc14748fe7
commit
1f652b60e5
3 changed files with 32 additions and 4 deletions
|
@ -79,6 +79,10 @@
|
||||||
lib-tests = import ./tests/lib-tests.nix {
|
lib-tests = import ./tests/lib-tests.nix {
|
||||||
inherit (pkgs) pkgs lib;
|
inherit (pkgs) pkgs lib;
|
||||||
};
|
};
|
||||||
|
extra-args-tests = import ./tests/extra-args.nix {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (self.legacyPackages.${system}) makeNixvimWithModule;
|
||||||
|
};
|
||||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
hooks = {
|
hooks = {
|
||||||
|
|
26
tests/extra-args.nix
Normal file
26
tests/extra-args.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
makeNixvimWithModule,
|
||||||
|
pkgs,
|
||||||
|
}: let
|
||||||
|
generated = makeNixvimWithModule {
|
||||||
|
module = {importedArgument, ...}: {
|
||||||
|
extraConfigLua = ''
|
||||||
|
-- importedArgument=${importedArgument}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
extraSpecialArgs = {
|
||||||
|
importedArgument = "foobar";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.runCommand "special-arg-test" {
|
||||||
|
printConfig = "${generated}/bin/nixvim-print-init";
|
||||||
|
} ''
|
||||||
|
config=$($printConfig)
|
||||||
|
if ! "$printConfig" | grep -- '-- importedArgument=foobar'; then
|
||||||
|
echo "Missing importedArgument in config"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
touch $out
|
||||||
|
''
|
|
@ -12,13 +12,11 @@ default_pkgs: {
|
||||||
|
|
||||||
shared = import ./_shared.nix modules {
|
shared = import ./_shared.nix modules {
|
||||||
inherit pkgs lib;
|
inherit pkgs lib;
|
||||||
config = {
|
config = {};
|
||||||
_module.args = extraSpecialArgs;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
eval = lib.evalModules {
|
eval = lib.evalModules {
|
||||||
modules = [module wrap] ++ shared.topLevelModules;
|
modules = [module wrap {_module.args = extraSpecialArgs;}] ++ shared.topLevelModules;
|
||||||
};
|
};
|
||||||
|
|
||||||
handleAssertions = config: let
|
handleAssertions = config: let
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue