Stream: nix

Topic: Separating evaluation and realization


view this post on Zulip Srid (Feb 16 2024 at 13:22):

Just a little thing I found. You can evaluate a derivation first without building:

❯ nix path-info --derivation .#default
evaluating derivation 'git+file:///Users/srid/code/emanote#default'
/nix/store/sdsqgcdzzzxcc3f12gvn6i44vh0xwmnq-emanote-1.3.13.0.drv

And then realize (aka. 'build') the evaluated derivation,

❯ nix build --no-link --print-out-paths '/nix/store/sdsqgcdzzzxcc3f12gvn6i44vh0xwmnq-emanote-1.3.13.0.drv^out'
/nix/store/s79fra86jg0fxv5g084wb0dn7mp3scz8-emanote-1.3.13.0

As an aside, IFD involves evaluating the built path (a derivation) once again and building the resultant derivation. https://nixos.asia/en/ifd

view this post on Zulip Tim DeHerrera (Feb 16 2024 at 16:09):

Indeed. This is the entire premise behind std-ci as well

view this post on Zulip tgunnoe (Feb 20 2024 at 17:29):

oh, it just clicked to me that that's what the --derivation flag is attempting to describe. i think its vague hence i didn't understand it until now

view this post on Zulip Tim DeHerrera (Feb 20 2024 at 17:39):

Honestly after designing std-action, I really got the feeling that it was a missed opportunity in Nix's design that we didn't more heavily focus on the separation of "eval time" vs "build time". There was a lot of kerfuffle about the flake cache, and how it's not super efficient. But a derivation is it's own evaluation cache, after all


Last updated: Nov 15 2024 at 12:33 UTC