Nikita Karetnikov <nik...@karetnikov.org> skribis: >> It’s not needed. All that needed is the name of the executable file >> to wrap. > > I don't understand. How will 'rename-file' get the location of the > executable? For example: > > (wrap-program "wget" [...]) > > I guess that it will only work if you invoke 'wrap-program' from the > same directory.
Yes, and that’s what we want. However, the ‘exec’ line in the wrapper needs the absolute file name. For that it can do along the lines of: (string-append "exec " (canonicalize-path file)) >> For the case where there are have several variables you want to set. > > Could you provide an example? The following works without '#:rest': > > (display (wrap-program "wget" '(("PATH" ":" = ("/nix/.../gawk/bin")) > ("CERT_PATH" ":" suffix > ("/nix/.../share/certs" > > "/nix/.../foo/certs"))))) Yeah there are two choices: two required arguments (like above), where the second one is a list, or one required argument and one rest argument. In the latter case, you would instead do: (wrap-program "wget" '("PATH" ":" = ("/nix/.../gawk/bin")) '("CERT_PATH" ":" suffix ("/nix/.../share/certs" "/nix/.../foo/certs"))) I tend to prefer this form because it may be more concise in common cases. HTH, Ludo’.