Merge pull request #129924 from Ma27/flake-modules-pos

flake/lib.nixosSystem: add `_file`-keys for error-location if needed
This commit is contained in:
Maximilian Bosch 2021-07-14 10:29:04 +02:00 committed by GitHub
commit b4c4784f7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,8 +47,20 @@
})
];
})).config;
moduleDeclarationFile =
(builtins.unsafeGetAttrPos "modules" args).file;
# Add the invoking file as error message location for modules
# that don't have their own locations; presumably inline modules.
addModuleDeclarationFile =
m: {
_file = moduleDeclarationFile;
imports = [ m ];
};
in
modules ++ [
map addModuleDeclarationFile modules ++ [
{
system.nixos.versionSuffix =
".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}";