help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guix environment shebang interpreter


From: mlell
Subject: Re: guix environment shebang interpreter
Date: Thu, 06 Feb 2020 11:37:53 +0100
User-agent: Posteo Webmail

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

[Prev in Thread] Current Thread [Next in Thread]