From 46ca452d0b82a5f920ac334884e34532598901e2 Mon Sep 17 00:00:00 2001 From: Mirko Lenz Date: Sun, 7 Jan 2024 20:49:17 +0100 Subject: [PATCH] standalone: pass `extraSpecialArgs` to lib.evalModules directly (#914) --- tests/extra-args.nix | 30 +++++++++++++++++++++++------- wrappers/standalone.nix | 3 ++- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/tests/extra-args.nix b/tests/extra-args.nix index 76de9a1f..aabfc75d 100644 --- a/tests/extra-args.nix +++ b/tests/extra-args.nix @@ -2,14 +2,26 @@ makeNixvimWithModule, pkgs, }: let + defaultModule = {regularArg, ...}: { + extraConfigLua = '' + -- regularArg=${regularArg} + ''; + }; generated = makeNixvimWithModule { - module = {importedArgument, ...}: { - extraConfigLua = '' - -- importedArgument=${importedArgument} - ''; + module = { + regularArg, + extraModule, + ... + }: { + _module.args = {regularArg = "regularValue";}; + imports = [defaultModule extraModule]; }; extraSpecialArgs = { - importedArgument = "foobar"; + extraModule = { + extraConfigLua = '' + -- specialArg=specialValue + ''; + }; }; }; in @@ -17,8 +29,12 @@ in printConfig = "${generated}/bin/nixvim-print-init"; } '' config=$($printConfig) - if ! "$printConfig" | grep -- '-- importedArgument=foobar'; then - echo "Missing importedArgument in config" + if ! "$printConfig" | grep -- '-- regularArg=regularValue'; then + echo "Missing regularArg in config" + exit 1 + fi + if ! "$printConfig" | grep -- '-- specialArg=specialValue'; then + echo "Missing specialArg in config" exit 1 fi diff --git a/wrappers/standalone.nix b/wrappers/standalone.nix index 6e445b86..128db05a 100644 --- a/wrappers/standalone.nix +++ b/wrappers/standalone.nix @@ -16,7 +16,8 @@ default_pkgs: { }; eval = lib.evalModules { - modules = [module wrap {_module.args = extraSpecialArgs;}] ++ shared.topLevelModules; + modules = [module wrap] ++ shared.topLevelModules; + specialArgs = extraSpecialArgs; }; handleAssertions = config: let