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
Deprecate packageOverrides? #43266
Comments
cc @nbp |
If I do not make any mistake this should almost be a backward compatible overlay for adding the feature back: self: super:
(super.config.packageOverrides or (super: {})) super The remaining issue is about modifying any bootstrap packages. This should be fixed by including all the stages of the bootstrap as attribute names within the main fix-point. |
Given the current implementation of packageOverrides, yes, I think that should work :D |
Opened PR #43560 to implement this. |
Overlays seem tricky to use correctly. Therefore I think deprecation at this point could on net cause more UX damage than non-deprecation. I'm thinking about the long-term user I met at a meetup a couple months ago who hadn't migrated yet. 🤔
Looks like #26487 (comment) ran into similar search problems altho I don't understand the fix. Admittedly search isn't absolutely necessary since I can read the overlay files. And #25264 has a long discussion about how to get overlays to be picked up by tools, but I don't see any sign of commits or docs to streamline the situation. Altho I guess https://nixos.wiki/wiki/Overlays has most of it? Maybe hardening overlays and triaging / resolving the open issues on them (e.g., #24907 #28558 ) before deprecating? And the existing docs on overlays could maybe be better as there are nuances that could to be called out a bit more strongly, e.g. single file needs to return a list while overlays in a directory are functions. |
I've converted an overlay to a packageOverrides construct lately because the overlay took too much memory to evaluate. It seems that a complete pkgs attrset mut be constructed on each fixpoint iteration. packageOverrides are more compact on memory usage exactly because they involve a local fixpoint. This is by no way meant to stop overlays, but it should be taken into consideration before deprecating packageOverrides too early. |
packageOverrides is implemented as a stage of nixpkgs which behaves just like an overlay, so I'm not sure I understand how this makes a difference. Although at this point it almost seems to me like removing overlays again might be better 🙈 |
I got random GC errors like "out of memory" or "too many heap sections" while using overlays (something similar to #40456). After converting overlays to packageOverrides, the errors disappeared. Actually no idea if this was just luck or a real solution. |
I currently use How would I do that - declaratively - with overlays? i.e. I don't want to have to run |
@asymmetric As documented in the warning in my PR https://github.com/NixOS/nixpkgs/pull/43560/files#diff-69df24a05ec3d577cb638113e9837ae1R119 : |
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
As mentioned on the issue, will do an RFC eventually |
I marked this as stale due to inactivity. → More info |
Is this still revalent? |
Yes |
@lheckemann if this is still relevant (which I think it is), then maybe it should be turned into an RFC. I don't think @edolstra's mild opposition to this should stop you from writing it, for the record :) Otherwise, it should be left stale and closed, eventually. |
for some value of eventually… |
I marked this as stale due to inactivity. → More info |
In the meantime, we may change the documentation without deprecating I was helping a newcomer that used I guess the use of |
So to clarify, should this packageOverrides = pkgs: {
myPackages = pkgs.buildEnv {
name = "my-packages";
paths = [ pkgs.hello ];
};
}; be replaced with final: prev: {
myPackages = prev.buildEnv {
name = "my-packages";
paths = [ prev.hello ];
};
} as an overlay |
@YoshiRulz yes, that looks mostly correct (though usually you'd want to get |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-is-fixed-point-used-for-overriding-nixpkgs-packages/35476/4 |
packageOverrides
is replaced by overlays as far as functionality goes, and has a number of disadvantages:packageOverrides
,pkg.override
introduced bycallPackage
, andpkg.overrideAttrs
introduced bystdenv.mkDerivation
. This is very confusing to beginners (it was to me as well, and we didn't have overlays at the time). Additionally,packageOverrides
shares a space with overlays while being less powerful.self: let super = self.pkgs;
to get an approximation of what overlays provide, but it inrtoduces a fixpoint in each layer AFAIU. I personally don't know exactly how this works, but overlays are pretty clear in this respect.For this reason, I think it would be nice to deprecate
packageOverrides
(remove it from docs in favour of overlays, add a warning when nixpkgs is evaluated withconfig.packageOverrides
set) and eventually remove it completely, leaving perhaps only an explanatory error message. The warning/error messages should explain how to turn apackageOverrides
function into an overlay to ease use of existing third-party documentation.Any opinions on whether this is a good idea at all, further practical considerations, or any other relevant commentary welcome!
The text was updated successfully, but these errors were encountered: