Closed rmcgibbo closed 3 years ago
And we could probably deduplicate this with namePositions
attribute in the top of the expression.
And even replace getDrvSourceLocation args
with originalDrv.meta.position
now that we have access to originalDrv
in the overlays.
Yeah, there are a few calls to getDrvSourceLocation, both there and in namePositions at the top of the nix-instantiate
expression but I wasn't yet sure if they could all be integrated into one.
Yeah, it would be nice if we could just do
diff --git a/tools/nixpkgs-hammer b/tools/nixpkgs-hammer
index 406d72f..4aae624 100755
--- a/tools/nixpkgs-hammer
+++ b/tools/nixpkgs-hammer
@@ -208,12 +208,15 @@ def main(args):
builtAttrs = [ {" ".join(attrs_nix)} ];
packageSet = {args.nix_file};
cleanPkgs = import {args.nix_file} {{ }};
- namePositions = builtins.filter (p: p != null) {indent(name_positions_nix, 2 + 1).strip()};
+ namePositions = builtins.filter (p: p != null) (builtins.map ({{ position }}: position) (builtins.attrValues report));
pkgs = import {args.nix_file} {{
overlays = {indent(overlays_nix, 2 + 2).strip()};
}};
- in {indent(attr_messages_nix, 2 + 0).strip()}
+
+ report = {indent(attr_messages_nix, 2 + 1).strip()};
+ in
+ report
'''
)
but Nix is not lazy enough for that. We really need namePositions
defined in terms of cleanPkgs
.
EDITOR=echo nix edit
is rather ridiculous. It turns out it's implemented by callingmeta.position
(https://github.com/NixOS/nix/blob/master/src/nix/edit.cc#L34 and https://github.com/NixOS/nix/blob/master/src/libexpr/attr-path.cc#L108), so why not do that ourselves and avoid starting up an extra 2 processes.