wrapProgram is a thin wrapper around makeWrapper, both defined in
make-wrapper.sh
All they do is exactly the same as the custom wrapper make below.
You can nlook for uses of makeWrapper / wrapProgram across nixpkgs.
kdeWrapper, wrapQtProgram & co are refinements of this concept. They
call wrapProgram with extra, custom settings for resp. KDE, Qt, GNOME &
co. To avoid stacking wrappers, they sometimes provide an extension
mechanism. kdeWrapper does not.
For now, I would keep the custom hack. It is the simplest solution.
https://github.com/abbradar/nixpkgs/blob/124e5dd3eb9e3e8fe322d3c62e4501b2043ac898/pkgs/build-support/setup-hooks/make-wrapper.sh
-- Layus.
On 07/05/17 22:40, José Luis Lafuente wrote:
The wrapper derivation approach works nicely, thanks!
I'm trying to understand how to achieve the same with stackable
wrappers, but not sure how. The examples in
https://github.com/NixOS/nixpkgs/pull/24858
<https://github.com/NixOS/nixpkgs/pull/24858> are using wrapQtProgam
and wrapPythonPrograms. In both cases there is a way to extend the
created wrapper, you can set `makeWrapperArgs` for wrapPythonPrograms,
or you can pass extra arguments to wrapQtProgram. But okular uses
kdeWrapper, which doesn't seem to offer a way to extend the created
wrapper. Is it really not possible to extend the wrapper created with
kdeWrapper, or am I missing something?
On Fri, May 5, 2017 at 4:12 PM, Guillaume Maudoux (Layus)
<layus...@gmail.com <mailto:layus...@gmail.com>> wrote:
Stackable wrappers are implemented in
https://github.com/NixOS/nixpkgs/pull/24858
<https://github.com/NixOS/nixpkgs/pull/24858>, but you will need
to wait for that package to land in master, and then get included
in some channel :-).
You can also create a trivial wrapper derivation:
|# file ~/.nixpkgs/config.nix { pkgs, ...}: { packageOverrides =
super: rec { customOkular = pkgs.writeScriptBin "okular" ''
#!/usr/bin/env bash export MYVAR=something exec
${pkgs.okular}/bin/okular "$@" ''; ... |
and then nix-env -iA nixos.customOkular :-).
— Layus.
On 05/05/17 15:02, José Luis Lafuente wrote:
Hi,
I want to override an existing package to use it locally. I would
like to just set an environment variable before the program is
executed, but the derivation is using `wrapProgram`, so there is
already a wrapper for the program. Is possible to override the
derivation to add another environment variable to the wrapper?
The derivation I want to modify is okular
(https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/kde/okular.nix
<https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/kde/okular.nix>)
Thanks in advance,
José Luis
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl <mailto:nix-dev@lists.science.uu.nl>
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
<https://mailman.science.uu.nl/mailman/listinfo/nix-dev>
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev