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

Idea: packages' input for perSystem which is equivalent to self'.packages #69

Open
cor opened this issue Nov 11, 2022 · 6 comments
Open
Labels
undecided Depends on postponed design decision

Comments

@cor
Copy link

cor commented Nov 11, 2022

In projects that use flake-parts, very often there are references to self'.packages. It might be nice to define packages' as one of the possible inputs for the perSystem function, which is defined as self'.packages

@shanesveller
Copy link

Do you see this as offering any new possibilities for things you couldn't express without it, or is it purely for convenience/concision?

@cor
Copy link
Author

cor commented Nov 11, 2022

Do you see this as offering any new possibilities for things you couldn't express without it, or is it purely for convenience/concision?

It is purely for convenience/concision

@roberth
Copy link
Member

roberth commented Nov 11, 2022

This will trade a bit of learning for quite a bit of convenience.
Possible downsides:

  • fewer people may learn to use config
  • this adds yet another way to access the same thing

I think the name could be packages, to mirror the local option. The ' is only necessary for naming things that come from outside of perSystem.
Whether it should be taken from self'.packages or config.packages, I'm not quite sure

self'.packages

  • if (if) Nix is to implement caching at the flake boundary between flakes, instead of at the more-or-less CLI level, this will be faster
  • may contain extra packages if flake-parts is used in a recursiveUpdate-like expression with something else. I'd recommend people to use the flake option for this instead.

config.packages

  • will never become strict in the attrset values, whereas we may implement the removal of empty attributes between the module system and the flake interface. In other words: lazier, so fewer infinite recursions 🎉

@cor
Copy link
Author

cor commented Nov 12, 2022

I think the name could be packages, to mirror the local option.

Agreed

  • fewer people may learn to use config

I in fact didn't know about how to use config. Can't find info on how it works on flake.parts, are there any docs on how to use this? We're currently using self'.packages everywhere. Didn't run into any infinite recursions yet though

@roberth
Copy link
Member

roberth commented Nov 12, 2022

any docs

Not much beyond "config, options, lib, ...: standard module system parameters."
This assumes experience with the module system, which is not something I can assume anymore as the project grows. There's no module system manual, sadly.
I will add more learning style docs (but might take a while).

Didn't run into any infinite recursions yet though

Great! I've held of the attribute filtering changes that would cause them. I'll keep prioritizing robustness over aesthetics.

@dhess
Copy link

dhess commented Nov 27, 2022

On a related note, I was surprised to see that pkgs passed to perSystem doesn't include self.overlays, per my testing and this comment here: #50 (comment)

I suppose I can see the argument that it's not what you always want, or that it might be surprising, but it would be helpful if there were an additional pkgs argument passed to perSystem which included the local overlays.

@roberth roberth added the undecided Depends on postponed design decision label Feb 1, 2023
shymega pushed a commit to shymega/flake-parts that referenced this issue Aug 18, 2024
69: add ruff r=zimbatm a=zimbatm



Co-authored-by: zimbatm <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
undecided Depends on postponed design decision
Projects
None yet
Development

No branches or pull requests

4 participants