Hello, I was wondering if it’s possible to introspect the Nix references graph at evaluation time.
I know it’s possible to get the references graph at build time using exportReferencesGraph. For instance, this derivation
pkgs.runCommand
"test"
{ exportReferencesGraph = [ "bash-graph" pkgs.bash ]; }
"mv bash-graph $out"
when built, produces the following file:
/nix/store/0hx32wk55ml88jrb1qxwg5c5yazfm6gf-bash-5.2-p15
2
/nix/store/0hx32wk55ml88jrb1qxwg5c5yazfm6gf-bash-5.2-p15
/nix/store/8xk4yl1r3n6kbyn05qhan7nbag7npymx-glibc-2.35-224
/nix/store/8xk4yl1r3n6kbyn05qhan7nbag7npymx-glibc-2.35-224
2
/nix/store/8xk4yl1r3n6kbyn05qhan7nbag7npymx-glibc-2.35-224
/nix/store/dh0jscni558i609q1s299qlrdbdj9jxa-libidn2-2.3.2
/nix/store/cnjwrrhnqn114jf5x0dwhx3jiaw6600d-libunistring-1.1
1
/nix/store/cnjwrrhnqn114jf5x0dwhx3jiaw6600d-libunistring-1.1
/nix/store/dh0jscni558i609q1s299qlrdbdj9jxa-libidn2-2.3.2
2
/nix/store/cnjwrrhnqn114jf5x0dwhx3jiaw6600d-libunistring-1.1
/nix/store/dh0jscni558i609q1s299qlrdbdj9jxa-libidn2-2.3.2
Is there a way to get something like this remaining in the Nix language itself?
I know that one could use an IFD to build that derivation at evaluation time but I would like to avoid IFDs if possible.
Thanks