Hi!

Is there a Guix equivalent of the nix-shell shebang?


You could imagine something like:

#! /usr/bin/env guix environment --ad-hoc PKG1 PKG2 ... -- INTERPRETER


But alas, on linux you cannot put more than one argument in the shebang line.

See this discussion: https://unix.stackexchange.com/questions/399690/multiple-arguments-in-shebang

But, one answer there has a possible solution for you: https://unix.stackexchange.com/a/399698

--8<-------------------------------------------------------
#!/bin/sh -

if [ "$1" != "--really" ]; then exec bash --posix -- "$0" --really "$@"; fi

shift

# Processing continues
----------------------------------------------->8-----------

It lets the script `exec` itself with the right arguments! So maybe put

exec guix environment --ad-hoc PKG1 PKG2 ... -- INTERPRETER "$0" "$@"

there?


Cheers,
Moritz

Reply via email to