How to making Guix scripts portable across other UNIX-like systems given Guix's atypical file system structure?

127 Views Asked by At

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

There are 1 best solutions below

2
Diego Torres Milano On BEST ANSWER

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