Skip to content

Commit 3934483

Browse files
committed
top-level/by-name-overlay: set meta.position
1 parent 4ac2eb7 commit 3934483

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

pkgs/by-name/sm/sm64baserom/package.nix

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ let
2828
}
2929
.${region};
3030
};
31-
result = runCommand "baserom-${region}-safety-dir" { } ''
31+
result = runCommand "baserom-${region}-safety-dir" { passthru = { inherit romPath; }; } ''
3232
mkdir $out
3333
ln -s ${file} $out/${file.name}
3434
'';
35+
romPath = "${result.outPath}/${file.name}";
3536
in
3637
result
37-
// {
38-
romPath = "${result.outPath}/${file.name}";
39-
}

pkgs/stdenv/generic/check-meta.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,8 @@ let
571571
// attrs.meta or { }
572572
// {
573573
# Fill `meta.position` to identify the source location of the package.
574-
${if pos == null then null else "position"} = pos.file + ":" + toString pos.line;
574+
${if pos == null || attrs ? meta.position then null else "position"} =
575+
pos.file + ":" + toString pos.line;
575576

576577
# Maintainers should be inclusive of teams.
577578
# Note that there may be external consumers of this API (repology, for instance) -

pkgs/top-level/by-name-overlay.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ self: super:
4949
# and whether it's defined by this file here or `all-packages.nix`.
5050
# TODO: This can be removed once `pkgs/by-name` can handle custom `callPackage` arguments without `all-packages.nix` (or any other way of achieving the same result).
5151
# Because at that point the code in ./stage.nix can be changed to not allow definitions in `all-packages.nix` to override ones from `pkgs/by-name` anymore and throw an error if that happens instead.
52-
_internalCallByNamePackageFile = file: self.callPackage file { };
52+
_internalCallByNamePackageFile =
53+
file:
54+
(self.callPackage file { })
55+
# Ensure that even a package that is a simple override of another package
56+
# has a position that points to its own file.
57+
.overrideAttrs
58+
(old: {
59+
meta = old.meta or { } // {
60+
position = "${toString file}:1";
61+
};
62+
});
5363
}
5464
// mapAttrs (name: self._internalCallByNamePackageFile) packageFiles

0 commit comments

Comments
 (0)