-
-
Notifications
You must be signed in to change notification settings - Fork 14.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
wrapGAppsHook: use makeBinaryWrapper #164163
Conversation
This can be easily fixed with |
That would work if the two wrappings happened in the same derivation, but there's a separate wrapper.nix stage. |
Technically the wrapper could override the gapps wrapper's flags but then you'd need to rebuild thunar every time you add a plugin, which defeats the point of having the wrapper separate |
We could override that but it would require a recompile or we clone the build derivation and dirty patch the wrapper. |
@@ -18,6 +18,7 @@ assertExecutable() { | |||
# --set-default VAR VAL : like --set, but only adds VAR if not already set in | |||
# the environment | |||
# --unset VAR : remove VAR from the environment | |||
# --chdir DIR : change working directory (use instead of --run "cd DIR") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we log a warning or error when this is done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anything short of parsing shell syntax would have to be an ugly heuristic like "the command starts with cd" which is bound to miss some legitimate use cases, so I vote no
We could also move the wrapping entirely to the wrapper or use a totally unwrapped program for plugin support and add the required variables only later. There are multiple ways to fix this independently of binary wrapper. |
Sounds like working around a technical limitation that has no raison d'être ("can't have more than one layer of wrappers") |
If the goal is to totally switch most things to binary wrappers we should also not layer them. |
I'm not seeing the connection, I think these are independent questions. To be clear, when I said "the basic motivation" I meant what motivated me to make this PR. I'm not saying we shouldn't unlayer the wrappers, or that this is the only way to fix thunar, but it seemed like a logical step forward. |
Would it be possible to have That seems like it'd be a simpler change and would likely also solve this problem everywhere with minimal changes needed treewide. |
I thought about this some time ago and eventually dropped the idea, but I can't remember why precisely. I think it felt like a layer violation because a wrapper (much less a wrapper builder) shouldn't have to know about the thing it's wrapping (imagine that the wrapped program is a mutable path like It would probably fix argv0 issues if done correctly, but doing it correctly doesn't seem significantly easier than this PR, and I think binary wrappers are a cleaner solution for now. (Also note there's NixOS/rfcs#75 roughly going in that direction) |
I think this broke signal-desktop. Recently I get Originally posted by @xaverdh in #158175 (comment) This nixpkgs/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix Line 126 in f419dc5
|
So the right solution for |
That would be a workaround, though it's slightly complicated to implement right now because Another option would be to somehow support this pattern in binary wrappers, but that seems a bit awkward. |
Well #172315 appears to be working actually. |
Nope (see discussion there). Apparently whichever of |
When wrapGAppsHook switched to a binary wrapper (NixOS#164163), relying on environment variables being evaluated in gappsWrapperArgs at runtime no longer works.
The use of --add-flags in this derivation does not work with binary wrappers, which wrapGAppsHook uses since NixOS#164163.
The use of --add-flags in this derivation does not work with binary wrappers, which wrapGAppsHook uses since NixOS#164163.
The use of --add-flags in this derivation does not work with binary wrappers, which wrapGAppsHook uses since NixOS#164163.
The use of --add-flags in this derivation does not work with binary wrappers, which wrapGAppsHook uses since NixOS#164163.
The use of --add-flags in this derivation does not work with binary wrappers, which wrapGAppsHook uses since NixOS#164163.
The use of --add-flags in this derivation does not work with binary wrappers, which wrapGAppsHook uses since NixOS#164163.
The use of --add-flags in this derivation assumed quotes to be expanded, which the binary wrapper (which wrapGAppsHook uses since NixOS#164163) will not do.
The use of --add-flags in this derivation assumed quotes to be expanded, which the binary wrapper (which wrapGAppsHook uses since NixOS#164163) will not do.
WIP to make the GApps wrapper use
makeBinaryWrapper
instead ofmakeWrapper
. cc @bergkvist @doronbehar @tfcThe basic motivation is that some applications like thunar are wrapped twice, once by
wrapGAppsHook
and once manually to add support for plugins, and because of the way shell scripts work this results in thunar's argv0 being set to.thunar-wrapped_
, which is reflected in the X11 class name for all thunar windows. I already mentioned this issue at #126248 (comment) and this was one of the motivations formakeBinaryWrapper
(#124556). Making the outer wrapper binary isn't enough to solve this, hence this PR.This isn't as easy as it sounds for at least two reasons (more may arise!):
makeBinaryWrapper
uses a wrapped GCC and will hence respectNIX_CFLAGS_COMPILE
, which resulted in an error when trying to buildlibreoffice
because a flag in itsNIX_CFLAGS_COMPILE
was for C++ only. I believe the wrapper shouldn't be affected by whatever CFLAGS happen to be set in the calling derivation, so I unset those variables in d399e701aa79815148ce08b41ed7263f122f1d24 (more unsetting may be needed). (I also tried to usegcc-unwrapped
but got more errors)makeWrapper
andwrapGAppsHook
in their build inputs, and because setup hooks are propagated, both versions of the wrapping functions are installed and it seems like the binary ones win. This made the build ofminecraft
fail because the binary version doesn't implement--run
, so I replaced every instance of--run "cd $foo"
I could find with--chdir "$foo"
in a4b32633e8c6429d2f2a02f70373d20e5d966ee6 and mademakeWrapper
implement--chdir
in 2e3ae88a9c830ba18163c778ade179e7cc820cd3. I am not sure how exactly we want to resolve the issue of conflicting versions of wrapper hooks; maybe it's a good thing that all wrappers around a program are of the same "type".I tried building a few things but I don't have a build farm handy and my server ran out of disk space 😬. Can I request a dedicated hydra jobset for this branch or something? cc @vcunat