Skip to content

Instantly share code, notes, and snippets.

@grahamc

grahamc/x.nix Secret

Created April 27, 2018 23:28
Show Gist options
  • Save grahamc/5e27f2697fba2636cf0078bb590eb89e to your computer and use it in GitHub Desktop.
Save grahamc/5e27f2697fba2636cf0078bb590eb89e to your computer and use it in GitHub Desktop.
let
trace' = t: builtins.trace t t;
toplevel = rec {
middle = {
lower = "hi"; # <---------------------------------------------------,
}; # |
inherit (middle) lower; # <--------------------------------------, |
}; # | |
# | |
# currently, unsafeGetAttrPos will identify 'lower' is defined at -/ |
# |
# instead of -----------------------------------------------------------/
# _POSSIBLY_ even, if possible, it'd be cool to have:
# {
# line = 9;
# column = 21;
# file = "/home/grahamc/projects/nixpkgs/x.nix";
# parent = {
# line = 8;
# column = 7;
# file = "/home/grahamc/projects/nixpkgs/x.nix";
# parent = null;
# };
# }
loc = builtins.unsafeGetAttrPos "lower" toplevel;
in trace' loc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment