Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[RFC 0075] Declarative wrappers #75
base: master
Are you sure you want to change the base?
[RFC 0075] Declarative wrappers #75
Changes from 15 commits
ef81400
b780229
d09a058
37c7a8c
2a0a630
c9d7055
abb7609
d1cadb6
a570b1a
8db3605
5ddd60b
778bc99
44a3b87
0b259fa
d75c73e
94038bd
0fa64ab
ffacf5f
f754ad7
4ab0448
60d3825
f3416a0
c092848
732246d
67b002b
cac0cbb
7b0c9e1
034a13e
edbf315
48f9118
73421fd
f0c2533
391f5d0
fb0dd98
c51c9c0
31a24a0
a6123b9
a65ac77
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Both of the issues related to gdk-pixbuf only happened for non-wrapped derivations and current
wrapGAppsHook
would already fix them.The issue was, IIRC, that gdk-pixbuf NixOS module sets
GDK_PIXBUF_MODULE_FILE
environment variable, which was enabling binary gdk-pixbuf modules with ABI incompatible with the gdk-pixbuf the programs linked against. In one case it was caused by a bug that slipped through the ABI stability guarantees, in the other by running a program fori686
onx86_64
.Either way, it is somewhat orthogonal to wrappers. Only that we might want to always wrap graphical applications with librsvg gdk-pixbuf module.
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.
Though there is one concern around
GDK_PIXBUF_MODULE_FILE
– the environment variable supports only a single path so we need to build the cache containing all the modules usinggdk-pixbuf-query-loaders
– the current hook actually does not actually do that! but it is required for some image formats to work in e.g.eog
. We will need to take inspiration in the module.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.
More related issues with wrappers NixOS/nixpkgs#160923 and the ones linked at NixOS/nixpkgs#160923 (comment)
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.
An alternative to this is the libtool approach, which still allow you to use strace,gdb etc: https://www.gnu.org/software/libtool/manual/html_node/Invoking-libtool.html
If a binary wrapper is used than it should be compiled for every target as this increases package size/build time. Instead having the wrapper reading its actual configuration from the same directory might work.
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.
Compiling a binary wrapper for each target is probably a small overhead. All it needs to do is modify the environment and exec the target. This should be a trivial C program. I think I would rather it be something trivial like that then needing to read config files which is somewhat more complicated. Although if we really want to optimize we would need some proper profiling about build time and execution time (including cache effects).
But either way I think this proposal enables us to solve this problem, we can figure out the details when start to tackle it.
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.
@Mic92 do you mean it should not be compiled for each package?
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.
Worked a bit on a wrapper tool some time ago: svep. Maybe there are some useful ideas there?
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.
That's a nice tool :), but I'm not sure it helps a lot, it seems it only supplies an alternative to
makeCWrapper
, but that depends on rust, and not pure C99.We won't be able for example to use it to save the wrapping information of a package, as we want to access that information independently, from
${pkg}/nix-support/
, and not from the binaries that the package may distribute.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.
Limiting ourselves to environment variables is at times too limiting. Also, environment variables should be the implementation detail, although the variable names could be used as identifier.
Python example.
If you have a closure of packages, and there happens to be a Python application with Python libraries as dependencies, then that group of packages needs to be composed. If there is another Python application depending on other libraries, then that needs to be composed separately. At least, they are not allowed to share the same
*PYTHONPATH
. (Note one also should not usePYTHONPATH
but that's a different discussion.)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.
I see this is all about ABI compatibility, and I understand the issue while I remember you mentioned this in NixOS/nixpkgs#85103 . I'm still unsure whether it's possible it'd happen, assuming our libraries are composed OK. @FRidh could you perhaps give a situation (with perhaps some rough code examples) to a situation where say Python2's and Python3's libraries will share the same
*PYTHONPATH
? It's important to note that the current design counts uponbuildInputs
andpropagatedBuildInputs
only.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.
Different Python version is one case, the other is simply applications requiring different versions of a dependency.
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.
This can happen for example when you have a python3 application that shells out to an python2 application.
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.
Currently we prevent some of these effects by unsetting
NIX_PYTHONPATH
when a Python program starts, thereby avoiding leakage. This problem with wrappers and environment variables should also be noted clearly in the RFC.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.
OK I think I start to understand better the concerns. But still, this is not a "Drawback" of the idea, I mean, we still need to workaround such edge cases specifically in our current methods right? I agree though that it might be more complicated if someone is obliged to use
wrapGeneric
and not a wrap hook.As an implementation detail, it may be worth noting that it'd be nice to make
wrapGeneric
able to "catch" such incompatible values in an environment variable.