So there are many issues we’re having regarding wrappers:
- Python: wrapPythonPrograms should not add (propagated) build inputs to wrappers · Issue #24128 · NixOS/nixpkgs · GitHub
- Patch gobjectIntrospection to use GI_GIR_PATH · Issue #32790 · NixOS/nixpkgs · GitHub
- python: propagate makeWrapper arguments by rnhmjoj · Pull Request #83321 · NixOS/nixpkgs · GitHub
- [RFC] Python library wrappers by timokau · Pull Request #53816 · NixOS/nixpkgs · GitHub
- Abort Qt builds that do not use a supported deriver by ttuegel · Pull Request #70691 · NixOS/nixpkgs · GitHub
- Qt: Do not require mkDerivation by ttuegel · Pull Request #71089 · NixOS/nixpkgs · GitHub
- buildFHSChrootEnv: link gsettings-schemas to FHS location by worldofpeace · Pull Request #83705 · NixOS/nixpkgs · GitHub
- do not invoke wrapProgram directly, make a wrapProgramsHook · Issue #78792 · NixOS/nixpkgs · GitHub
Today I came up with an idea for a builder that could wrap programs with the appropriate environment without using wrap{GApps,Qt}hook
at all. This needs more thinking, but I’d be glad to hear comments.
What if we’ll start by writing down all we know about environmental variables needed at runtime. Maybe something like this:
wrappingEncyclopedia = {
QT_PLUGIN_PATH = {
provided_by = [
qt5.qtbase
];
subpath = "/lib/qt-${qt5.qtbase.version}/plugins";
};
QML2_PLUGIN_PATH = {
provided_by = [
qt5.qtbase
];
subpath = "/lib/qt-${qt5.qtbase.version}/qml";
};
XDG_DATA_DIRS = {
provided_by = [
gsettings-desktop-schemas
];
subpath = "/share";
};
GST_PLUGIN_SYSTEM_PATH_1_0 = {
...
}
...
};
With this, I imagine the builder recursively searching through the dependency tree of the package-to-wrap for dependencies that need an environmental variable, according to the encyclopedia. Then, with either symlinkJoin
or buildEnv
, we can add all of these dependencies to paths
and wrapProgram
would not even need to concatenate paths with :
, but he’ll be able to use (e.g):
--prefix XDG_DATA_DIRS : $out/share
(This would also prevent issues like what #84679 fixed)
In order to use this new wrapping method, a contributor would use:
wrappedPackage = neoWrap (callPackage ../applications/myPackage { });