Nikita Karetnikov <nik...@karetnikov.org> skribis: >> wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" > > How can I get the output of a package?
With the recently-added ‘package-output’ (singular): --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (package-output s binutils "out") $2 = "/nix/store/bfh5c2a4is27jdmc811fp6g0jfac7fiw-binutils-2.22" scheme@(guile-user)> (package-output s binutils "lib") $3 = "/nix/store/n29brzqlhjkzww51labk9anx493gl4d3-binutils-2.22-lib" --8<---------------cut here---------------end--------------->8--- Under the hood it calls ‘package-derivation’, which does the actual output path computation. >> #!/bin/sh >> export PATH="/nix/store/...-gawk/bin:$PATH" >> exec ./.guile-snarf-real "$@" > > Should it be saved as 'guile-snarf'? And I have to use rename(2), > right? You first rename the wrapped program, then create the wrapper as above, and finally chmod it so that it’s executable. > What should I use to handle prefixes (e.g., a keyword, a simple > argument)? Should they be case insensitive? Good question. The thing is that sometimes you want to affect several environment variables. Maybe something like: (define* (wrap-program file #:rest variables) ...) Where each rest argument has a form like this: ("PATH" ":" prefix ("/nix/.../foo/bin" "/nix/.../bar/bin")) Instead of ‘prefix’, users could ask for ‘prefix’ (prepend to the search path) or ‘=’ (set the search path to exactly that value.) WDYT? Ludo’.