-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
nixgl: forward override calls to wrapped package #6029
base: master
Are you sure you want to change the base?
Conversation
I'm a bit lost as to how all of this works. First, I'm confused as to how using Second, you are replacing the |
Basically, the chromium module implements the My goal with this wrapper is to have the resulting package behave identically to the original one, to avoid bugs like this when someone passes a wrapped package into other home manager modules. Otherwise, a user passing a wrapped package into a module would have to figure out why other options aren't working, and then essentially re-implement the module options by directly modifying the package they are wrapping, which is a bad user experience. wrapping a package with nixGL should not break other module options someone is already using, as it did in #6016. Forwarding I figured this change would be a bit unclear, which is why a left a comment, but I'll admit it was hard to come up with a succinct explanation of what the new |
Ah, I see, thanks for the explanation. I totally missed the fact that many HM modules will add their own wrapper, which is obvious in retrospect, although I wonder how common the approach taken by Chromium actually is. With this in mind, it seems to me that the approach you have taken here is appropriate. I'll try to come up with an explanation to add to the code; sure, blaming would find it, but that's more work than someone reading the code casually is typically willing to do :) . Thanks for clearing this up. This issue is something that is important to keep in mind whenever you make a package wrapper, and I haven't realized it before. |
Co-authored-by: Jure Varlec <[email protected]>
@rycee this should be ready for review! |
Looks like the build failures are the same as #6039 and unrelated to this change. |
The build failures seem to have sprung up as a result of something having changed in nixpkgs-unstable recently. The referenced podman PR had similar errors on a 2024-10-29 flake, but the issues are no longer there on 2024-11-02 and 2024-11-05 flakes. Not really sure what to make of it, but posting to confirm it is unrelated to your changes. EDIT: I set the nixpkgs-unstable flake to one from 2024-10-02 and it's passing as expected. Don't have time right now to try and track down a specific rev that caused the tests to start failing. |
Description
Currently, wrapping packages with
nixGL.wrap
will break any options in home manager modules that useoverride
to modify the package.This change overrides
override
on the wrapper package, such that it will instead forward the call to the internal package, and return a wrapped version of the result with the same arguments.Tested via the
programs.chromium.commandLineArgs
option mentioned in #6016, with several other wrapped packages in my config to regression test.Fixes #6016.
Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
ornix develop --ignore-environment .#all
using Flakes.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Maintainer CC