flake-compat icon indicating copy to clipboard operation
flake-compat copied to clipboard

Compatibility with `builtins.getFlake`

Open zimbatm opened this issue 4 years ago • 3 comments

What do you think if flake-compat was changed to provide the same output as builtins.getFlake? That way, most of the logic can be substituted if the builtin exists.

Then the other issue is to select the right shell and packages from the current system, which I think is a separate concern. For this I would propose to extend the flake schema to include currentSystem = { packages = []; devShell = <drv>; <...> }.

With both of these combined, flake-compat is the same as builtins.getFlake, and the flake schema would look something like this:

{ 
  description = "";
  inputs = {};
  outputs = inputs: {};
  currentSystem = {};
}

zimbatm avatar Jan 01 '21 11:01 zimbatm

What do you think if flake-compat was changed to provide the same output as builltins.getFlake?

Isn't that the case already?

edolstra avatar Jan 12 '21 11:01 edolstra

It's quite close to being a poly-fill for builtins.getFlake, but not quite. It would need to output result without the defaultNix and shellNix attributes. And the input parameters aren't exactly the same as builtins.getFlake either.

zimbatm avatar Jan 12 '21 15:01 zimbatm

It would actually also be really nice if it were possible to add polyfills for builtins.getFlake and builtins.fetchTree (inasmuch as that is possible).

jsoo1 avatar Dec 09 '21 05:12 jsoo1