It should be enough, and more appropriate, to simply preserve argv[0] in
wrappers.
Ludo’.
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 4407f9a..ebe70a3 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -870,8 +870,7 @@ the previous wrapper."
(with-output-to-file prog-tmp
(lambda ()
(format #t
- "#!~a~%~a~%exec -a \"~a\" \"~a\" \"$@\"~%"
- (which "bash")
+ "#!~a~%~a~%exec -a \"$0\" \"~a\" \"$@\"~%"
(string-join (map export-variable vars)
"\n")
(canonicalize-path prog)