edolstra / flake-compat

MIT License
251 stars 71 forks source link

allow exposing additional attributs from flake result #51

Closed adrian-gierakowski closed 1 year ago

adrian-gierakowski commented 1 year ago

things like: lib, modules, or any other arbitrary attrs

proposal: add and optional getExtraAttrs (or extractExtraAttrs) argument here:

https://github.com/edolstra/flake-compat/blob/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9/default.nix#L8

which would be expected to be a function from flake result to attrs, with the result merged into here

adrian-gierakowski commented 1 year ago

another way of achieving this would be to split the code into 2 function

  1. one for producing the full flake result
  2. another one for extracting defaultNix and shellNix

then if one wanted to extract arbitrary stuff from the flake they could compose 1 with a function of their own choosing. These could live in a separate file (lib.nix) so that the interface of default.nix could remain unchanged

adrian-gierakowski commented 1 year ago

sorry for the noise, the entire parsed flake is already returned within defaultNix:

https://github.com/edolstra/flake-compat/blob/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9/default.nix#L192-L193