Merge pull request #130570 from Ma27/flake-pos-eval-error
flake.nix: Only add `_file`-key if position of `args.modules` is actually know to the evaluator
This commit is contained in:
commit
6564e7ef13
10
flake.nix
10
flake.nix
@ -49,12 +49,18 @@
|
|||||||
})).config;
|
})).config;
|
||||||
|
|
||||||
moduleDeclarationFile =
|
moduleDeclarationFile =
|
||||||
(builtins.unsafeGetAttrPos "modules" args).file;
|
let
|
||||||
|
# Even though `modules` is a mandatory argument for `nixosSystem`, it doesn't
|
||||||
|
# mean that the evaluator always keeps track of its position. If there
|
||||||
|
# are too many levels of indirection, the position gets lost at some point.
|
||||||
|
intermediatePos = builtins.unsafeGetAttrPos "modules" args;
|
||||||
|
in
|
||||||
|
if intermediatePos == null then null else intermediatePos.file;
|
||||||
|
|
||||||
# Add the invoking file as error message location for modules
|
# Add the invoking file as error message location for modules
|
||||||
# that don't have their own locations; presumably inline modules.
|
# that don't have their own locations; presumably inline modules.
|
||||||
addModuleDeclarationFile =
|
addModuleDeclarationFile =
|
||||||
m: {
|
m: if moduleDeclarationFile == null then m else {
|
||||||
_file = moduleDeclarationFile;
|
_file = moduleDeclarationFile;
|
||||||
imports = [ m ];
|
imports = [ m ];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user