Nikita Karetnikov <nik...@karetnikov.org> skribis:

> I guess that I can implement this one:
>
> ** Add equivalent to Nixpkgs's ‘wrapProgram’
>
> What's the purpose of 'wrapProgram'?  Could you elaborate?

Here’s an example from the Guile expression in Nixpkgs:

  wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"

What it does is that it renames guile-snarf to .guile-snarf-real, and
makes guile-snarf a wrapper around the real one, like this:

  #!/bin/sh
  export PATH="/nix/store/...-gawk/bin:$PATH"
  exec ./.guile-snarf-real "$@"

This is useful for scripts that expect particular programs to be in
$PATH, for programs that expect particular shared libraries to be in
$LD_LIBRARY_PATH, or modules in $GUILE_LOAD_PATH, etc.

The source for Nixpkgs’s ‘wrapProgram’ is at:

  
https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/make-wrapper.sh

In our case, the equivalent would be a procedure in (guix build utils).
The generated wrapper would probably still be a Bash script as above.

Thanks!

Ludo’.

Reply via email to