-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
flake.nix expose forAllSystems #208020
base: master
Are you sure you want to change the base?
flake.nix expose forAllSystems #208020
Conversation
This allows flake users to use nixpkgs.lib.forAllSystems
464b30d
to
2c35752
Compare
I guess that once this is in, it will make the project https://github.com/numtide/flake-utils obsolete? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same function is also used in release-lib.nix, I think we can just move it to lib to reduce duplicate code
That one has a different set of systems if I read the code correctly. |
Since Other people's objections also still apply, see:
Please use |
To everyone who doesn't care about the set of systems, I 100% agree, but that's a problem to be fixed in Nix itself, not in Nixpkgs. The flakes schema requires us to think about the set of systems. If you disagree with this design choice, help out with https://github.com/NixOS/nix instead of papering over it with hacks like this. |
Can you explain why it's arbitrary? It's based on the RFC how we define tiers for nixpkgs support.
But that's literally what nixpkgs does and anything that consumes nixpkgs will at most suppport this kind of systems. Why is it OK to be used in nixpkgs but not the consumers of nixpkgs?
So all flakes out there are using this composition and we should instruct them to use it, but we should forbid making it one function? |
I'll phrase it differently, for someone that comes newly to Nix and wants to write a flake, what logic do we recommend them to use for systems? And hopefully the answer is not a PhD thesis paper. |
iirc @edolstra's stance on the system for which to add attrs, is just the explicitly supported (by reason or by tests?) systems, to be determined by the flake author. This should therefore usually be a smaller set.
Other flakes aren't Nixpkgs and are supposed to consider for themselves what to support. By letting the flake author write their own
Assuming they don't use any framework like {
# ...
outputs = { nixpkgs, ... }:
let inherit (nixpkgs) lib;
supportedSystems = [ "x86_64-linux" ];
forSystems = lib.genAttrs supportedSystems;
in {
# ...
};
} As for my own opinion, I agree that |
Whole nixpkgs works on the principle of having attributes for all platforms and builds failing if it a derivation doesn't build. So the whole idea that lack of an attribute means platform isn't support won't work since the user will learn quickly it's a broken promise. But flakes makes
Creating a door for the user to be confused about: Did I forget something? Did I mistype something? Now they need to ask all flakes they depend on to specify that platforms so that you can even try to see if it builds. All this complexity costs for what exactly? |
Here's exactly what happens when a new user is faced with this, to back up my claims: https://discord.com/channels/1036369714731036712/1036369758024650792/1064497129030176799 |
@domenkozar I have 0 doubt about your claims. I only disagree about the particular solution. We'll be discussing the system handling in the flake schema today in the Nix team. I wish we could have done that sooner, but it got delayed because of the holidays. |
@domenkozar A |
The Promised Update
The team has not made a decision today to make the pragmatic choice to implement NixOS/nix#6773 or a similar change in the short term. However, the good news is that we've had a productive and positive discussion about the stabilization of these experimental features, which makes me hopeful about the future of these features, albeit in the long term. This also means that I have to make good on my implicit promise. (I guess I was hesitant to spell it out) So the answer is that system handling won't change in the short term. I also see the reality that many people have committed to flakes as if they were stable. It would have been unfortunate to have people change their flakes shortly before Nix itself would vastly improve the situation, but that won't be the case for probably multiple months. Things being what they are, I'll go ahead and allow incremental improvements to happen. We'll have a function that will be made obsolete. So be it, if it helps users today. So...I'm reopening this PR to allow a hopefully temporary workaround to be added to the code that's already part of an experimental feature. Do not be surprised when it is deprecated. Or be positively surprised by the alternative. 🎉 |
It does not, but it proves the point if that was indeed a system attribute not supported by a flake. I'm happy to hear this is moving further 🥳 Thanks for the hard work! |
I think this is close to done. An item in the release notes would be appropriate. @fricklerhandwerk do you still think experimental features should not be documented in the manuals? Perhaps we could have a section or at least something? I feel like we're wasting a lot of potential by postponing it until the very end of the stabilization process. |
I never actually thought we shouldn't, and just followed what I perceived as an existing convention, agreeing with what @edolstra essentially argued today that using experimental features in examples will lead to confusion and churn. By all means we should have a section that acknowledges experimental features and the extent to which Nixpkgs supports them. If there is much more than that, we should possibly set up a convention to mark functions as relying on experimental features. |
Just my 2 nix'es: In the future, once flakes are stabilized and are feature complete I'd expect to see simple flakes look something like this: https://github.com/gytis-ivaskevicius/nix-patterns/tree/master/07-blueprints-no-nixpkgs This has several advantages:
|
This sounds like a problem that's covered by I understand the wart, and agree that forcing deep What I'm not really following is how avoiding a Nixpkgs input resolves these issues. Unless you completely avoided Maybe I'm misunderstanding your pitch though. |
You are not wrong, but here are the main points:
|
Blueprints are ok, but they're only one solution in a spectrum of ways you can work with dependencies.
Each of these is a valid way of presenting and consuming packages, but none of them have a finalized design or cli integration
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2022-01-05-documentation-team-meeting-notes-22/25535/1 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nix-systems-externally-extensible-flake-systems/27110/8 |
Is there anything worth looking? I am very confused. |
Description of changes
This allows flake users to use nixpkgs.lib.forAllSystems
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes