diff --git a/flake.nix b/flake.nix index 5a976be1..d77f3954 100644 --- a/flake.nix +++ b/flake.nix @@ -79,6 +79,10 @@ lib-tests = import ./tests/lib-tests.nix { 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 { src = ./.; hooks = { diff --git a/tests/extra-args.nix b/tests/extra-args.nix new file mode 100644 index 00000000..76de9a1f --- /dev/null +++ b/tests/extra-args.nix @@ -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 + '' diff --git a/wrappers/standalone.nix b/wrappers/standalone.nix index ca4a47e5..6e445b86 100644 --- a/wrappers/standalone.nix +++ b/wrappers/standalone.nix @@ -12,13 +12,11 @@ default_pkgs: { shared = import ./_shared.nix modules { inherit pkgs lib; - config = { - _module.args = extraSpecialArgs; - }; + config = {}; }; eval = lib.evalModules { - modules = [module wrap] ++ shared.topLevelModules; + modules = [module wrap {_module.args = extraSpecialArgs;}] ++ shared.topLevelModules; }; handleAssertions = config: let