-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
No global settings in libnixfetchers
and libnixflake
#11007
No global settings in libnixfetchers
and libnixflake
#11007
Conversation
libnixfetchers
and libnixflake
libnixfetchers
and libnixflake
3b3bf0f
to
307cbfb
Compare
Not in favor of this. As we discussed recently, this causes a huge amount of code churn and adds tedious |
What if we instead made Unless there's a really good reason for static init? |
We can keep on discussing this, but I consider gratuitous globals completely unacceptable in a library, and the new code much easier to read and test because the flow of information is made explicit. (And I think a lot of user experience stuff depends not on Nix CLI, but the downstream projects people will make with the libraries --- that's where the user benefit comes from.) It is also a necessary step to removing the current configuration system, which I very much do not like, and make a nicer JSON one.
There is multiple |
I mean it could be one |
@fricklerhandwerk See |
@fricklerhandwerk If it makes a difference to you, once I use this to move the config file handling code out of |
Wait, when would we even have multiple clients at once? And why can't we then register fetchers with the evaluator rather than globally? I understand that moving all of this code around is work, but there surely is a sequence of small steps that gets us there safely - if that's where we want to even want to go. |
Maybe I am writing an multi-tenant web application in which different customers want to have different fetch settings
The sort of auto registrations we have to day are inherently global. I would like to someday move away from that but it's a larger not smaller patch.
The one thing that makes this smaller is doing the fetchers stuff and flake stuff separately, but I still thinking "smaller" is a red herring here. It's not unreliably large, and splitting "churn" over multiple PRs doesn't actually decrease churn. |
b7f7c92
to
60e8297
Compare
You have to consider the YAGNI principle here. These libraries are not intended for external consumers, but only for use in Nix. I'm not aware of an actual use case (other than multi-threaded unit tests) that would be significantly helped by this refactoring. Meanwhile there is a real cost to code churn like this (e.g. I had to spend some time yesterday to update the lazy-trees branch to resolve the previous settings-related PR, and I imagine this one has an even bigger impact).
That scares me even more... |
I can't hear this anymore. If we reject changes based on line count, how will we ever make process on cross-cutting issues?
That branch is too big and not in a mergeable state because it has a observable nondeterminism problem in the expression language. Haven't we already agreed that the right process to get that project done is to extract reviewable changes from that branch? |
I am happy to keep on merging Perhaps @edolstra is skeptical of this because it hasn't happened yet. Well, let's make it start right now. I'll push to |
I just pushed a zero-conflict resolution of |
1f7386f
to
41e812e
Compare
edolstra#14 fixes the conflicts in |
Could we merge this after this bugfix? #10891 |
Progress on NixOS#5638 There are still a global fetcher and eval settings, but they are pushed down into `libnixcmd`, which is a lot less bad a place for this sort of thing. Continuing process pioneered in 52bfccf.
41e812e
to
3fc77f2
Compare
Those issues have nothing to do with whether our settings objects are global or passed around by reference.
Given that we all have limited time, big changes like this need to be useful, i.e. they need to be motivated by an actual user need, not because they make the code subjectively nicer (and I would argue that passing settings arguments around everywhere isn't nicer and doesn't make the code easier to read or maintain).
Making reviewable changes only becomes harder because of big refactoring PRs, since having more PRs open means more work keeping them in sync with master. (Yes, annoyed because we now need to fix a bunch of merge conflicts.) |
Just to clarify, I agree this particular change makes it more ugly than before, and I also hate it that we get more merge conflicts. But @Ericson2314 convinced me that things will get continuously better. That is not to make it "subjectively nicer", but "objectively less effort to understand for people not familiar with the code base". I may be the only vocal data point on this, but currently the config system is just confusing because information is not local and execution order isn't obvious or hard to trace. Also, merge conflicts get more likely with large long-standing PRs. We discussed this often enough, and even wrote into the contribution guidelines to aim for small changes that can be merged quickly. Merge conflicts also get more likely where the code isn't cleanly separating concerns. We can alleviate that by talking to each other and coordinating more closely. Yes, this is overhead. Doing more stuff always means more overhead. |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-07-10-nix-team-meeting-minutes-160/49101/1 |
Motivation
Progress on #5638
There are still a global fetcher and eval settings, but they are pushed down into
libnixcmd
, which is a lot less bad a place for this sort of thing.Context
Continuing process pioneered in 52bfccf.
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.