Add builtins.getContext.

This can be very helpful when debugging, as well as enabling complex
black magic like surgically removing a single dependency from a
string's context.
This commit is contained in:
Shea Levy 2019-01-13 12:43:46 -05:00
parent 087be7281a
commit 1d757292d0
No known key found for this signature in database
GPG key ID: 5C0BD6957D86FE27
5 changed files with 158 additions and 38 deletions

View file

@ -0,0 +1 @@
true

View file

@ -0,0 +1,22 @@
let
drv = derivation {
name = "fail";
builder = "/bin/false";
system = "x86_64-linux";
outputs = [ "out" "foo" ];
};
path = "${./eval-okay-context-introspection.nix}";
desired-context = {
"${builtins.unsafeDiscardStringContext path}" = {
path = true;
};
"${builtins.unsafeDiscardStringContext drv.drvPath}" = {
outputs = [ "foo" "out" ];
allOutputs = true;
};
};
legit-context = "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}";
in builtins.getContext legit-context == desired-context