From a2c29561e722e9546c61323a91f9faffcc3bf268 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 18 May 2022 18:46:35 +0200 Subject: [PATCH] lib.types.deferredModule: Improve reported location --- lib/tests/modules.sh | 2 +- lib/types.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 155d7e5fa3d2..29f6272ea50a 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -198,7 +198,7 @@ checkConfigOutput '^true$' config.submodule.enable ./declare-submoduleWith-path. # default module is merged into nodes.foo checkConfigOutput '"beta"' config.nodes.foo.settingsDict.c ./deferred-module.nix # errors from the default module are reported with accurate location -checkConfigError 'In `default from the-file-that-contains-the-bad-config.nix'\'': "bogus"' config.nodes.foo.bottom ./deferred-module.nix +checkConfigError 'In `the-file-that-contains-the-bad-config.nix, via option default'\'': "bogus"' config.nodes.foo.bottom ./deferred-module.nix # Check the file location information is propagated into submodules checkConfigOutput the-file.nix config.submodule.internalFiles.0 ./submoduleFiles.nix diff --git a/lib/types.nix b/lib/types.nix index 22a329264457..83882179d06d 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -544,7 +544,7 @@ rec { name = "deferredModule"; description = "module"; check = t: isAttrs t || isFunction t; - merge = loc: defs: map (def: lib.setDefaultModuleLocation "${showOption loc} from ${def.file}" def.value) defs; + merge = loc: defs: map (def: lib.setDefaultModuleLocation "${def.file}, via option ${showOption loc}" def.value) defs; }; # The type of a type!