-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
Move lib
to a separate repository
#381862
Comments
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/monorepos-dont-map-to-our-social-structure/44162/46 |
Splitting lib into its own repo just makes sense to me. It is independent from the rest of Nixpkgs, barely any PRs touch both (as far as I've observed) and tracking lib changes in the main repo feels counterproductive. I think this move would make iteration of nixpkgs.lib cleaner, CI faster, and dependencies more stable. Plus, it makes consuming just the lib cheaper! +1 for standalone lib! |
Is there a technical reason that this is impossible? I would naively assume that a GHA workflow could automatically label PRs that touch files in
this makes me a tad uneasy. how do you propose to catch lib changes which result in nixpkgs breakage? (not that such cases are necessarily easily caught currently, I'll admit.) I think I am mostly curious about the detail of how the syncing will work - if new interfaces are added to lib, how long will it be before they can be used in nixpkgs, for example? ("immediate" automated commits to master? automated PRs daily, weekly, ...? would such PRs be merged automatically, or require review?) and would it become more difficult to test (parts of) nixpkgs against a given lib change? |
Perhaps I missed it — would |
It does label PRs already, but it can't label (non-PR) issues automatically :)
Oh that's a great point, so we should keep running the full eval in the lib repo. Yup, because if the repo gets mirrored to Nixpkgs' |
How exactly will this work? Will |
Yes that's the plan.
Automation magic 🧙 But oh right, didn't answer this yet
My first thought was to sync it immediately with an automated commit, but I guess we should at least run Nixpkgs CI, so we should have PRs. And at that point I think doing a weekly PR that gets automatically merged if CI passes would be best. |
If it helps any I did rewrite the NixPkgs lib as its own standalone library last year. If anything, could be useful for surveying the surface area of things to keep in Nixpkgs. |
With weekly merges, I can see some gridlock that comes up if someone wants to rely on new lib functionality. EDIT: regarding things to look at, Project Ekala might be interesting to look at regarding splitting |
This is a great idea. I already use nixpkgs.lib in a few projects. Let's formalize what's already useful for people who just want lib without downloading an entire nixpkgs tarball! |
While I agree with the key points of the problem statement, I do have a few serious objections that splitting lib to a separate repo is the only reasonable or by far the optimal solution. There is enough weighing trade-offs that I request this should be discussed RFC-style in a living document. Specifically, some of these problems are independent, such as only-lib-download size and issue tracking, and treating them more carefully as such would open room for more creative approaches. |
The one thing I like about working with nixpkgs is that I have a single repository to look at. A single PR to file. A single Hydra jobset to configure (for larger stuff such as glibc updates). A bit more context on that: https://discourse.nixos.org/t/contributor-retention/12412/42 Granted, Wouldn't it be another option to explore tooling like https://josh-project.github.io/josh/faq.html ? AFAIU this would provide both the monorepo experience to maintainers and the polyrepo experience to consumers. Because I fully agree with the motivation from a consumer & contributor perspective, to not fetch a full nixpkgs tarball or to not clone all of nixpkgs when becoming a contributor[1] that only cares about a specific subsystem. However, as a maintainer I must say that I'm afraid that this will make it harder for me to contribute to nixpkgs in the long run. [1] In fact, my nixpkgs checkout is part of my backup and when I get a new machine, I restore it from the backup because I'm not patient enough to wait for a clone. |
FetchingFor the goal of making |
Forking
The organizational issue around changes can also be solved with a Linux-style forking workflow. This way, |
I'm hugely in favor of having a standalone standard nix library that's maintained by the community without splitting the work between 5 or more different projects or attempts. My main question, though, reading this threat, is what the outcome of this issue is supposed to be. |
I love the idea and I am very much for it 🚀, but I keep thinking of various edge-cases the more and more I think about automatic mirroring. Should What should happen if additional changes are merged into the Can Should we support mirroring from Should mirroring only sync the files, or should the commits and their messages also be mirrored? Can we do so while preserving commit signatures? Should we rewrite commit messages such that references to PRs and issues reference the correct repo? (i.e. |
Rebuilds
If we want to make it a proper component, we should move NIxpkgs flake
|
I think we should explore Josh more closely, never heard of it before, but it seems great. |
I fail to see a compelling reason to kill one of the strengths of nixpkgs, aka the monorepo. Maybe because I dont contribute to lib/ that much (might have added 5/6 functions and some tests). But I do spend a lot of time grepping for stuff in lib/ because nix is not typed and as a consequence, I often have to consult those functons to understand what's going on. To me the main reason would be to have a smaller repo to clone when you dont need nixpkgs but it's already solved by nixpkgs.lib . |
Well, nixpkgs will already be pulling in lib, could we expose it the same way we already do? I don't think anything necessarily needs to break. |
I only skimmed through the comments, sorry if I am repeating something that was already voiced. I don't mean to discourage, but my impression is that the main motivation here is to enforce boundaries: ensure that EDIT(2025-02-15): A later comment of @kampka also mentions flakes, which I hadn't addressed but other people have, downloading the full checkout of Nixpkgs. A predictable knee-jerk reaction is that the solution is neither a fork nor a split-off, but adding a sparse checkout support to flakes |
That is definitely not the only motivation. The nixpkgs lib is useful in and of its own to build downstream projects that do not require |
Agreed, as the next step towards this I'd create a living RFC-like document that includes all the arguments people have brought up in this issue, and PR it to the Nixpkgs repo for further discussion (not a fan of the RFC process). Then we can also use GitHub threads! Because this issue is already pretty long, I'd like to propose something procedural before it gets much longer: Before making a comment, read the full proposal and discussion, and only post what hasn't been brought up before. Since this would be turned into an RFC-like document before being decided, the main goal with this issue should be to just collect arguments for and against this change, there's no need to convince everybody that we should or should not do it. Whether we end up doing this shouldn't be decided by the number of comments/reactions for/against, but rather by solid arguments, so let's make sure we're not missing anything :) |
I think we have to address accessibility too, like monorepos have numerous benefits to |
After a night's sleep, I feel like highlighting one more point: one appeal I see in this proposal is that with a separate repository we'd be better incentivized to relax the dependency of Nixpkgs on |
Multiple problems and multiple solutions have been discussed. Not sure if this format would do the landscape justice, but we'll see.
The current stability and simplicity do prevent problems, and most of all, user-facing complexity. A complete redesign that lives besides a legacy |
Important
This is a long thread, so before making a comment, please read the full proposal and discussion, and only post what hasn't been brought up before. Thanks!
I've previously suggested this on Discourse (and again here), which has garnered a surprising number of likes, so let's consider this! Here's a first draft proposal to discuss
Motivation
lib
(note: not everything, see the plan below) is arguably the most independent part of Nixpkgs, it has effectively no dependency on anything other than itself (and Nix) and virtually no PRs touch bothlib
and non-lib
(which is also in the lib PR guidelines).lib
, which makeslib
development hard to track. Yes there's a label, but e.g. people can't just watch the entire repo.lib
to depend on Nixpkgs, this encourages stabilisation of interfaces between them and untangles any messy dependencies between them.lib
changes, and the other way around too.CONTRIBUTING.md
/README.md
, etc.Plan
lib
should stay in Nixpkgs, off the top of my head at least the systems stuff and maintainers (could also consider moving that to a different repo at some point, but that's orthogonal). Refactor Nixpkgs so that thelib
directory is ready to be moved.lib
directory (Nixpkgs is very self-contained right now, and while this could be changed, it's very tricky, maybe controversial and not necessary for now if we just mirror)git subtree
mirroring beforelib
-specific CI actions to the new repo, this should include at least part of the Nixpkgs manual build, which builds docs forlib
, but also some otherslib
PRs that they should be moved to the new repo now, or do it automatically (probably not worth it, not manylib
PRs are actively being worked on)I've also done a successful split of a Nixpkgs component into a separate repository before with nixpkgs-vet (previously known as nixpkgs-check-by-name), so we can reuse some of that knowledge. I think @willbush and @philiptaron can also attest the benefits of a separate repo :)
Let's get some general consensus on whether we should do this. If we do agree, somebody will have to lead this effort, which might as well be me (as always, probably sponsored by Tweag/Modus Create and Antithesis! ✨) :)
Ping @roberth @hsjobeki @adisbladis @Profpatsch
The text was updated successfully, but these errors were encountered: