summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--flake.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 5237cae86f1..92c0d97c4a2 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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"}";