Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

establish stable output api using lazy derivations #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

blaggacao
Copy link
Contributor

@blaggacao blaggacao commented Jun 16, 2023

use lazyDerivation with the added benenfits as per its docstring

@takeda
Copy link

takeda commented Aug 19, 2023

This looks interesting. Any potential drawback of using this?

Copy link
Owner

@nlewo nlewo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make it for the pullImageFromManifest function also?

@nlewo
Copy link
Owner

nlewo commented Aug 19, 2023

@blaggacao Could you explain more in detail what issue it fixes? (maybe with an example)

@blaggacao blaggacao force-pushed the establish-stable-output-api-using-lazy-derivations branch from 37a40b3 to d244dc1 Compare August 28, 2023 19:10
@blaggacao
Copy link
Contributor Author

blaggacao commented Aug 28, 2023

@blaggacao Could you explain more in detail what issue it fixes? (maybe with an example)

It's the different between a clean backyard and a dumpster, sort of.

If you ever had your grievances with about 20 mkDerivation attributes that mostly make no sense of all and you never actually find (e.g. in the repl or during command completion) what you're looking for. If you once had that sort of experience when using Nix, then this is a fix.

The output becomes as clean as it can get, e.g.: (I deliberately remove same-system task scripts such as copyTo* from passthru in divnix/std)

nix-repl> x86_64-linux.cardano-services.oci-images.cardano-services.
x86_64-linux.cardano-services.oci-images.cardano-services.drvPath     x86_64-linux.cardano-services.oci-images.cardano-services.outputName
x86_64-linux.cardano-services.oci-images.cardano-services.image       x86_64-linux.cardano-services.oci-images.cardano-services.outputs
x86_64-linux.cardano-services.oci-images.cardano-services.meta        x86_64-linux.cardano-services.oci-images.cardano-services.system
x86_64-linux.cardano-services.oci-images.cardano-services.name        x86_64-linux.cardano-services.oci-images.cardano-services.type
x86_64-linux.cardano-services.oci-images.cardano-services.out
x86_64-linux.cardano-services.oci-images.cardano-services.outPath

What a relieve for the eye, fresh and veteran, alike!

QED.


But there's more. meta is still evaluated lazily but without triggering evaluation of the now lazy derivation. So, suppose you want to make an inventory of a really big project and you want to collect all meta.description and render them into the second column. This is now cheap. Before, it was expensive. 😄

Think of this now costing negligible compute:

nix-repl> x86_64-linux.cardano-services.oci-images.cardano-services.meta.description
"Minimal Cardano Services OCI Image"

2 QED.


A much, much better rundown can be found at the source.

@blaggacao blaggacao force-pushed the establish-stable-output-api-using-lazy-derivations branch from d244dc1 to 7fdfc3e Compare August 28, 2023 19:25
@blaggacao blaggacao requested a review from nlewo August 28, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants