0

Here is a trivial solution to the problem of writing a script on Guix.

#!/run/current-system/profile/bin/env -S guile -s
coding: utf-8
!#
(display "Hello, world!\n")

Notice that the path /run/current-system/profile/bin/env will not exist in other GNU systems such as Ubuntu or Debian. So, how would we take advantage of UNIX's exec system call without editing the script on other systems?

1 Answers1

0

If you want to keep the script as it is, on the other system (e.g. Debian, Ubuntu, etc.) make env available at the same location (you may need sudo)

mkdir -p /run/current-system/profile/bin
ln -s /usr/bin/env /run/current-system/profile/bin
Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • I think we're converging on the fact that there's nothing better to do, that is, we really must know where `env` is and that's it. Correct? So I guess Guix systems present a new problem to the nightmare task of writing portable programs on UNIX-like systems. – user21429471 Mar 22 '23 at 16:59
  • Totally agree. However, this fix applied once would fix all the scripts. – Diego Torres Milano Mar 22 '23 at 21:43