Reapply "splice.nix: make pkgs splicedPackages"#456138
Reapply "splice.nix: make pkgs splicedPackages"#456138philiptaron merged 6 commits intoNixOS:masterfrom
Conversation
lib/customisation.nix
Outdated
| @@ -726,7 +726,7 @@ rec { | |||
| pkgsTargetTarget = otherSplices.selfTargetTarget; | |||
| }; | |||
| spliced = extra spliced0 // spliced0 // keep self; | |||
| self = f self // { | |||
| self = f spliced0 // { | |||
There was a problem hiding this comment.
If we change self to be already spliced, do we also need to adjust this, a few lines above?
pkgsHostTarget = self; # Not `otherSplices.selfHostTarget`;
My understanding is pkgs<host><target> package sets are supposed to be un-spliced, otherwise they could get unintentionally shifted when placed into inputs.
There was a problem hiding this comment.
This doesn’t add the splices to the defined self, it just passes in the spliced packages to the scope’s function. The spliced packages were already accessible through self.callPackage, but not when using self directly – analogous to how packages in all-packages.nix aren’t from __splicedPackages.
(Admittedly though this means that f = self: { …; foo = self.bar; } would insert splices into the resulting self and therefore into its selfHostTarget – maybe that’s why it was not done?)
There was a problem hiding this comment.
Sorry, what I meant was that we'd be generating foo.__spliced.hostTarget from a spliced package set, instead of an unspliced one. Though thinking about it some more, I'm no longer sure if this would actually even be an issue.
There was a problem hiding this comment.
Right, what I mean is that if you do this:
makeScopeWithSplicing' {
…
f = self: {
foo = self.callPackage … { };
bar = self.callPackage ({ foo }: …) { };
};
}then bar’s foo dependency already has .__spliced today, because callPackage is defined in terms of spliced. Most packages are defined with callPackage already. (The return values of callPackage don’t have it, though; that’s added in later.)
What would change is that self.bar would gain .__spliced where it doesn’t currently have it – to me, this is less confusing than the status quo. OTOH, it does have the effect that:
makeScopeWithSplicing' {
…
f = self: {
foo = self.callPackage … { };
bar = self.foo;
};
}…would put bar.__spliced in the unspliced versions of the scope used to splice together the scope. That could be a problem; I’d assume it’s what’s happening with #456138 (comment).
(Maybe that is what you meant, but just making sure.)
There was a problem hiding this comment.
It's not exactly what I had in mind, but that indeed looks like a problem yeah.
There was a problem hiding this comment.
It doesn't feel to me like this can be avoided with the way splicing works though.
What if we kept self = f self // ... and instead made makeScopeWithSplicing' return spliced0? There's quite a bit more that would need to change in that function, but it would sort of mimic what was done to pkgs where pkgs to the outside was redefined to splicedPackages.
There was a problem hiding this comment.
(keeping this thread open, although not relevant anymore, because the commit was taken out again - will reference this thread in the follow up PR)
|
I'm smashing the subscribe button. |
|
Great idea |
The changes here wouldn’t cause that without the |
That's what I thought at first, but it doesn't seem to be the case, no, at least when I tried this morning. OTOH, I had received confusingly different results from time to time, so I'm not really trusting myself to always hold this correctly. I will test and confirm it again, but my current idea is that this is indeed already required for the actual reapply. |
|
I tested again: The reapply itself works in all my basic tests. It's the |
34c2a3e to
cb51825
Compare
I also looked into the eval failure by CI in I'll bring the drop for stdenv/native back with the scope commit in a separate PR. |
cb51825 to
1093f4a
Compare
|
I now did the following verification:
I found a diff for the windows platforms, which I fixed in the latest push. Afterwards, there was no diff anymore. I also I'll have to see whether any rebuilds remain after this push and look into them in more detail. In general, it'd not be unexpected to have some hashes changing - for cases where the packages should have been spliced before but were not. |
|
The changed packages now are:
Everything except nixpkgs/pkgs/by-name/mm/mmseqs2/package.nix Lines 22 to 25 in dd42bb1 Now, that's worrying in two aspects:
|
Actually it is fine, from this PR's perspective. The |
relibc itself has been removed in 2024 already.
This was removed recently when cleaning up aliases, but it breaks `pkgsCross.ben_nanonote`.
This will make `pkgs` used in `callPackage`, and `pkgsCross.X.pkgs` have packages with `__spliced`. https://www.github.com/NixOS/nixpkgs/blob/3029741718f4c765fbc5ebf76bea3d6c8ff15fe5/pkgs/development/interpreters/python/passthrufun.nix#L37 https://www.github.com/NixOS/nixpkgs/blob/d2bd9a39dec88eddd5c192abee69939e67f43d12/pkgs/top-level/python-packages.nix#L10720 ``` nix-repl> pkgsCross.aarch64-multiplatform.python3Packages.protobuf4.protobuf.__spliced error: … while evaluating the attribute 'aarch64-multiplatform.python3Packages.protobuf4.protobuf.__spliced' at /home/artturin/nixgits/my-nixpkgs/.worktree/1/pkgs/development/python-modules/protobuf/4.nix:119:13: 118| passthru = { 119| inherit protobuf; | ^ 120| }; error: attribute '__spliced' missing at «string»:1:1: 1| pkgsCross.aarch64-multiplatform.python3Packages.protobuf4.protobuf.__spliced | ^ ``` to ``` nix-repl> pkgsCross.aarch64-multiplatform.python3Packages.protobuf4.protobuf.__spliced { buildBuild = «derivation /nix/store/s7da5mfvx4h1n86j78knaj9cprglxqz6-protobuf-25.4.drv»; buildHost = «derivation /nix/store/s7da5mfvx4h1n86j78knaj9cprglxqz6-protobuf-25.4.drv»; buildTarget = «repeated»; hostHost = «derivation /nix/store/mszvybzs4zxh43awyrjnybsfcb265n9r-protobuf-aarch64-unknown-linux-gnu-25.4.drv»; hostTarget = «repeated»; } ``` Co-authored-by: Wolfgang Walther <[email protected]>
Now that `pkgs` is `__splicedPackages` on cross we can remove these variables I set. Assignments like `patchutils = pkgs.patchutils_0_3_3;` in `all-packages.nix` cannot be removed because the `pkgs` in `patchutils = pkgs.patchutils_0_3_3;` in `all-packages.nix` is coming from this `pkgs:` https://www.github.com/NixOS/nixpkgs/blob/b6e486730fc875ec79a3dea0f1f46eaf9f6ffa9d/pkgs/top-level/all-packages.nix#L9 instead of the `pkgs` in `with pkgs;`
1093f4a to
53391c3
Compare
|
mmseqs2 was fixed in #456530. This rebuild should disappear now and I consider the current state ready for review / ready to go, as a first step. Once this is merged, I will open two follow up PRs with the changes I backed out - but these will be draft for now, because they still hit infinite recursion in some places, and I will probably need help with these. |
philiptaron
left a comment
There was a problem hiding this comment.
I read through this commit-by-commit. Some questions were straightforward to answer, but a couple places could use bigger comments explaining what and why.
| in | ||
| dfold folder postStage (_: { }) withAllowCustomOverrides | ||
| pkgs.__splicedPackages |
There was a problem hiding this comment.
This could use a wall of text (or just a couple sentences) that explains
- Why we're returning
__splicedPackagesfrom this function. - What the various values are, vs.
pkgsdirectly.
53391c3 to
f2640ee
Compare
|
Maybe this could use a release note? I guess it’s a breaking change for people overlaying things into the bootstrap, but OTOH I don’t know if we provide compatibility guarantees for that. |
|
I would very much shy away from providing anything other than best wishes for that scenario. |
|
Well... actually this is a breaking change for anyone doing |
|
In brought back the additional changes in the following two draft PRs:
These don't work, yet, any help appreciated. |
|
This change broke naersk example of cross-compilation from Linux to Windows according to |
This reapplies #349316, which was tried in #362499, but then abandoned.
Does #349316 (comment), too, but not #349316 (comment). The latter still causes me some infrec headache for darwin cross.
Dropping
stdenv/nativealong the way, which was broken right now anyway - and causes infinite recursions through thesenativeTools& co. arguments.Things done
Add a 👍 reaction to pull requests you find important.