morph icon indicating copy to clipboard operation
morph copied to clipboard

Expose eval as nix attribute.

Open tomprince opened this issue 4 years ago • 4 comments

This allows using the nix portion of morph, without needing to know implementation details of where the nix expression is.

I'm not sure if the attributes exposed there want to be made public, or perhaps only some of them should be public.

tomprince avatar Sep 03 '21 03:09 tomprince

Can you explain the use case a little more? I think that it's a little weird compared to using the (import morph.lib [...] directly, which already seems pretty simple. :)

srhb avatar Nov 17 '21 10:11 srhb

Can you explain the use case a little more? I think that it's a little weird compared to using the (import morph.lib [...] directly, which already seems pretty simple. :)

I took inspiration from arion (which has a similar function here). If/when this change is included into nixpkgs, one benefit is that using pkgs.morph.eval { inherit networkExpr; } instead of import "${pkgs.morph.lib}/eval-machines.nix" { inherit networkExpr; } is that the former will use the nixpkgs morph is pulled from, rather than whatever <nixpkgs> happens to point to.

Also, by having an explicit function be the interface for using morph from nix, rather than a file in the derivation, it isolates the user from how exactly morph is implemented and built.

tomprince avatar Feb 07 '22 19:02 tomprince

I'll rebase this after #167 lands, since this re-indents default.nix.

tomprince avatar Feb 07 '22 20:02 tomprince

I am happy with this, did you want to rebase? :smile_cat:

srhb avatar Mar 04 '22 11:03 srhb