Skip to content

Commit

Permalink
Try pkg.meta.position before (unsafeGetAttrPos "src" pkg)
Browse files Browse the repository at this point in the history
Fixes `nixpkgs.mpvScripts.*`, discovered while reviewing NixOS/nixpkgs#308062
  • Loading branch information
pbsds committed May 6, 2024
1 parent cafad8c commit 2261701
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nix_update/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,22 @@ def eval_expression(
return f"""
let
{indent(dedent(let_bindings), " ")}
positionFromMeta = pkg: let
parts = builtins.match "(.*):([0-9]+)" pkg.meta.position;
in if pkg ? meta.position then {{
file = builtins.elemAt parts 0;
line = builtins.fromJSON (builtins.elemAt parts 1);
}} else null;
raw_version_position = sanitizePosition (builtins.unsafeGetAttrPos "version" pkg);
position = if pkg ? isRubyGem then
raw_version_position
else if pkg ? isPhpExtension then
raw_version_position
else
else if pkg ? meta.position then
sanitizePosition (positionFromMeta pkg)
else
sanitizePosition (builtins.unsafeGetAttrPos "src" pkg);
in {{
name = pkg.name;
Expand Down

0 comments on commit 2261701

Please sign in to comment.